xref: /minix3/external/bsd/llvm/dist/clang/test/SemaCXX/qualified-names-diag.cpp (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 -fsyntax-only -verify %s
2*f4a2713aSLionel Sambuc namespace foo {
3*f4a2713aSLionel Sambuc   namespace wibble {
4*f4a2713aSLionel Sambuc     struct x { int y; };
5*f4a2713aSLionel Sambuc 
6*f4a2713aSLionel Sambuc     namespace bar {
7*f4a2713aSLionel Sambuc       namespace wonka {
8*f4a2713aSLionel Sambuc         struct x {
9*f4a2713aSLionel Sambuc           struct y { };
10*f4a2713aSLionel Sambuc         };
11*f4a2713aSLionel Sambuc       }
12*f4a2713aSLionel Sambuc     }
13*f4a2713aSLionel Sambuc   }
14*f4a2713aSLionel Sambuc }
15*f4a2713aSLionel Sambuc 
16*f4a2713aSLionel Sambuc namespace bar {
17*f4a2713aSLionel Sambuc   typedef int y;
18*f4a2713aSLionel Sambuc 
19*f4a2713aSLionel Sambuc   struct incomplete; // expected-note{{forward declaration of 'bar::incomplete'}}
20*f4a2713aSLionel Sambuc }
test()21*f4a2713aSLionel Sambuc void test() {
22*f4a2713aSLionel Sambuc   foo::wibble::x a;
23*f4a2713aSLionel Sambuc   ::bar::y b;
24*f4a2713aSLionel Sambuc   a + b; // expected-error{{invalid operands to binary expression ('foo::wibble::x' and '::bar::y' (aka 'int'))}}
25*f4a2713aSLionel Sambuc 
26*f4a2713aSLionel Sambuc   ::foo::wibble::bar::wonka::x::y c;
27*f4a2713aSLionel Sambuc   c + b; // expected-error{{invalid operands to binary expression ('::foo::wibble::bar::wonka::x::y' and '::bar::y' (aka 'int'))}}
28*f4a2713aSLionel Sambuc 
29*f4a2713aSLionel Sambuc   (void)sizeof(bar::incomplete); // expected-error{{invalid application of 'sizeof' to an incomplete type 'bar::incomplete'}}
30*f4a2713aSLionel Sambuc }
31*f4a2713aSLionel Sambuc 
32*f4a2713aSLionel Sambuc int ::foo::wibble::bar::wonka::x::y::* ptrmem;
33*f4a2713aSLionel Sambuc 
34