Make an error message more clear.

llvm-svn: 74481
This commit is contained in:
Anders Carlsson 2009-06-30 00:06:57 +00:00
parent 651185bf47
commit 124f34c150
3 changed files with 4 additions and 2 deletions

View File

@ -1074,6 +1074,8 @@ def err_array_star_outside_prototype : Error<
"star modifier used outside of function prototype">;
def err_illegal_decl_pointer_to_reference : Error<
"'%0' declared as a pointer to a reference">;
def err_illegal_decl_mempointer_to_reference : Error<
"'%0' declared as a member pointer to a reference">;
def err_illegal_decl_mempointer_to_void : Error<
"'%0' declared as a member pointer to void">;
def err_illegal_decl_mempointer_in_nonclass : Error<

View File

@ -697,7 +697,7 @@ QualType Sema::BuildMemberPointerType(QualType T, QualType Class,
// C++ 8.3.3p3: A pointer to member shall not pointer to ... a member
// with reference type, or "cv void."
if (T->isReferenceType()) {
Diag(Loc, diag::err_illegal_decl_pointer_to_reference)
Diag(Loc, diag::err_illegal_decl_mempointer_to_reference)
<< (Entity? Entity.getAsString() : "type name");
return QualType();
}

View File

@ -16,7 +16,7 @@ int B::*pbi; // expected-error {{expected a class or namespace}} \
// expected-error{{does not point into a class}}
int C::*pci; // expected-error {{'pci' does not point into a class}}
void A::*pdv; // expected-error {{'pdv' declared as a member pointer to void}}
int& A::*pdr; // expected-error {{'pdr' declared as a pointer to a reference}}
int& A::*pdr; // expected-error {{'pdr' declared as a member pointer to a reference}}
void f() {
// This requires tentative parsing.