Douglas Gregor | e4e5b05 | 2009-03-19 00:18:19 +0000 | [diff] [blame] | 1 | // RUN: clang -fsyntax-only -verify %s |
| 2 | namespace 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 | |
| 16 | namespace bar { |
| 17 | typedef int y; |
Douglas Gregor | e625893 | 2009-03-19 00:39:20 +0000 | [diff] [blame] | 18 | |
| 19 | struct incomplete; // expected-note{{forward declaration of 'struct incomplete'}} |
Douglas Gregor | e4e5b05 | 2009-03-19 00:18:19 +0000 | [diff] [blame] | 20 | } |
| 21 | void test() { |
| 22 | foo::wibble::x a; |
| 23 | ::bar::y b; |
| 24 | a + b; // expected-error{{invalid operands to binary expression ('foo::wibble::x' (aka 'struct x') and '::bar::y' (aka 'int'))}} |
| 25 | |
| 26 | ::foo::wibble::bar::wonka::x::y c; |
| 27 | c + b; // expected-error{{invalid operands to binary expression ('::foo::wibble::bar::wonka::x::y' (aka 'struct y') and '::bar::y' (aka 'int'))}} |
Douglas Gregor | e625893 | 2009-03-19 00:39:20 +0000 | [diff] [blame] | 28 | |
| 29 | (void)sizeof(bar::incomplete); // expected-error{{invalid application of 'sizeof' to an incomplete type 'bar::incomplete' (aka 'struct incomplete')}} |
Douglas Gregor | e4e5b05 | 2009-03-19 00:18:19 +0000 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | int ::foo::wibble::bar::wonka::x::y::* ptrmem; |
Douglas Gregor | e625893 | 2009-03-19 00:39:20 +0000 | [diff] [blame] | 33 | |