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