Home | History | Annotate | Download | only in SemaCXX
      1 // RUN: %clang_cc1 -fsyntax-only -verify %s
      2 namespace A {
      3   namespace B {
      4     class C { }; // expected-note {{'A::B::C' declared here}}
      5     struct S { };
      6     union U { };
      7   }
      8 }
      9 
     10 void f() {
     11   A::B::i; // expected-error {{no member named 'i' in namespace 'A::B'}}
     12   A::B::C::i; // expected-error {{no member named 'i' in 'A::B::C'}}
     13   ::i; // expected-error {{no member named 'i' in the global namespace}}
     14 }
     15 
     16 namespace B {
     17   class B { };
     18 }
     19 
     20 void g() {
     21   A::B::D::E; // expected-error-re {{no member named 'D' in namespace 'A::B'{{$}}}}
     22   // FIXME: The typo corrections below should be suppressed since A::B::C
     23   // doesn't have a member named D.
     24   B::B::C::D; // expected-error {{no member named 'C' in 'B::B'; did you mean 'A::B::C'?}} \
     25               // expected-error-re {{no member named 'D' in 'A::B::C'{{$}}}}
     26   ::C::D; // expected-error-re {{no member named 'C' in the global namespace{{$}}}}
     27 }
     28 
     29 int A::B::i = 10; // expected-error {{no member named 'i' in namespace 'A::B'}}
     30 int A::B::C::i = 10; // expected-error {{no member named 'i' in 'A::B::C'}}
     31 int A::B::S::i = 10; // expected-error {{no member named 'i' in 'A::B::S'}}
     32 int A::B::U::i = 10; // expected-error {{no member named 'i' in 'A::B::U'}}
     33 
     34 using A::B::D; // expected-error {{no member named 'D' in namespace 'A::B'}}
     35 
     36 struct S : A::B::C {
     37   using A::B::C::f; // expected-error {{no member named 'f' in 'A::B::C'}}
     38 
     39 };
     40