diff --git a/clang/lib/Sema/SemaCXXScopeSpec.cpp b/clang/lib/Sema/SemaCXXScopeSpec.cpp index 3172c0aa52ca..d89a610caecb 100644 --- a/clang/lib/Sema/SemaCXXScopeSpec.cpp +++ b/clang/lib/Sema/SemaCXXScopeSpec.cpp @@ -310,9 +310,12 @@ Sema::CXXScopeTy *Sema::ActOnCXXNestedNameSpecifier(Scope *S, unsigned DiagID; if (SD) DiagID = diag::err_expected_class_or_namespace; - else if (SS.isSet()) - DiagID = diag::err_typecheck_no_member_deprecated; - else + else if (SS.isSet()) { + DiagnoseMissingMember(IdLoc, DeclarationName(&II), + (NestedNameSpecifier *)SS.getScopeRep(), + SS.getRange()); + return 0; + } else DiagID = diag::err_undeclared_var_use; if (SS.isSet()) diff --git a/clang/test/SemaCXX/missing-members.cpp b/clang/test/SemaCXX/missing-members.cpp index 91cde600f900..5fd4c54c1d94 100644 --- a/clang/test/SemaCXX/missing-members.cpp +++ b/clang/test/SemaCXX/missing-members.cpp @@ -13,6 +13,16 @@ void f() { ::i; // expected-error {{no member named 'i' in the global namespace}} } +namespace B { + class B { }; +} + +void g() { + A::B::D::E; // expected-error {{no member named 'D' in namespace 'A::B'}} + B::B::C::D; // expected-error {{no member named 'C' in class 'B::B'}} + ::C::D; // expected-error {{no member named 'C' in the global namespace}} +} + int A::B::i = 10; // expected-error {{no member named 'i' in namespace 'A::B'}} int A::B::C::i = 10; // expected-error {{no member named 'i' in class 'A::B::C'}} int A::B::S::i = 10; // expected-error {{no member named 'i' in struct 'A::B::S'}}