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