| 1 | // RUN: %clang_cc1 -fsyntax-only -verify %s |
| 2 | |
| 3 | namespace test0 { |
| 4 | struct A { |
| 5 | static int foo; |
| 6 | }; |
| 7 | |
| 8 | namespace i0 { |
| 9 | typedef int A; // expected-note {{declared here}} |
| 10 | |
| 11 | int test() { |
| 12 | struct A a; // expected-error {{typedef 'A' cannot be referenced with a struct specifier}} |
| 13 | return a.foo; |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | namespace i1 { |
| 18 | template <class> class A; // expected-note {{declared here}} |
| 19 | |
| 20 | int test() { |
| 21 | struct A a; // expected-error {{template 'A' cannot be referenced with a struct specifier}} |
| 22 | return a.foo; |
| 23 | } |
| 24 | } |
| 25 | |
| 26 | namespace i2 { |
| 27 | int A; |
| 28 | |
| 29 | int test() { |
| 30 | struct A a; |
| 31 | return a.foo; |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | namespace i3 { |
| 36 | void A(); |
| 37 | |
| 38 | int test() { |
| 39 | struct A a; |
| 40 | return a.foo; |
| 41 | } |
| 42 | } |
| 43 | |
| 44 | namespace i4 { |
| 45 | template <class T> void A(); |
| 46 | |
| 47 | int test() { |
| 48 | struct A a; |
| 49 | return a.foo; |
| 50 | } |
| 51 | } |
| 52 | |
| 53 | // This should magically be okay; see comment in SemaDecl.cpp. |
| 54 | // rdar://problem/7898108 |
| 55 | typedef struct A A; |
| 56 | int test() { |
| 57 | struct A a; |
| 58 | return a.foo; |
| 59 | } |
| 60 | } |
| 61 | |