diff --git a/clang/include/clang/Basic/DiagnosticSemaKinds.td b/clang/include/clang/Basic/DiagnosticSemaKinds.td index 8d56b57c08cf..652f7430f0c6 100644 --- a/clang/include/clang/Basic/DiagnosticSemaKinds.td +++ b/clang/include/clang/Basic/DiagnosticSemaKinds.td @@ -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< diff --git a/clang/lib/Sema/SemaType.cpp b/clang/lib/Sema/SemaType.cpp index c0b4e9fbecbc..7fa6d703c2af 100644 --- a/clang/lib/Sema/SemaType.cpp +++ b/clang/lib/Sema/SemaType.cpp @@ -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(); } diff --git a/clang/test/SemaCXX/member-pointer.cpp b/clang/test/SemaCXX/member-pointer.cpp index d2df5eb317a0..3b106d5576fe 100644 --- a/clang/test/SemaCXX/member-pointer.cpp +++ b/clang/test/SemaCXX/member-pointer.cpp @@ -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.