| 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 | |
| 41 | struct S1 {}; |
| 42 | |
| 43 | struct S2 : S1 {}; |
| 44 | |
| 45 | struct S3 : S2 { |
| 46 | void run(); |
| 47 | }; |
| 48 | |
| 49 | struct S4: S3 {}; |
| 50 | |
| 51 | void test(S4 *ptr) { |
| 52 | ptr->S1::run(); // expected-error {{no member named 'run' in 'S1'}} |
| 53 | } |
| 54 | |