blob: cb82f3189c7749b2e576dc8a1cfe42a3bed5d14b [file] [log] [blame]
Douglas Gregore4e5b052009-03-19 00:18:19 +00001// RUN: clang -fsyntax-only -verify %s
2namespace foo {
3 namespace wibble {
4 struct x { int y; };
5
6 namespace bar {
7 namespace wonka {
8 struct x {
9 struct y { };
10 };
11 }
12 }
13 }
14}
15
16namespace bar {
17 typedef int y;
Douglas Gregore6258932009-03-19 00:39:20 +000018
Douglas Gregor24c46b32009-03-19 04:25:59 +000019 struct incomplete; // expected-note{{forward declaration of 'struct bar::incomplete'}}
Douglas Gregore4e5b052009-03-19 00:18:19 +000020}
21void test() {
22 foo::wibble::x a;
23 ::bar::y b;
Douglas Gregor24c46b32009-03-19 04:25:59 +000024 a + b; // expected-error{{invalid operands to binary expression ('foo::wibble::x' (aka 'struct foo::wibble::x') and '::bar::y' (aka 'int'))}}
Douglas Gregore4e5b052009-03-19 00:18:19 +000025
26 ::foo::wibble::bar::wonka::x::y c;
Douglas Gregor24c46b32009-03-19 04:25:59 +000027 c + b; // expected-error{{invalid operands to binary expression ('::foo::wibble::bar::wonka::x::y' (aka 'struct foo::wibble::bar::wonka::x::y') and '::bar::y' (aka 'int'))}}
Douglas Gregore6258932009-03-19 00:39:20 +000028
Douglas Gregor24c46b32009-03-19 04:25:59 +000029 (void)sizeof(bar::incomplete); // expected-error{{invalid application of 'sizeof' to an incomplete type 'bar::incomplete' (aka 'struct bar::incomplete')}}
Douglas Gregore4e5b052009-03-19 00:18:19 +000030}
31
32int ::foo::wibble::bar::wonka::x::y::* ptrmem;
Douglas Gregore6258932009-03-19 00:39:20 +000033