Debian Codegraph @

clang/test/CXX/basic/basic.lookup/basic.lookup.elab/p2.cpp

raw
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 the '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 the '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 typedef struct A A;
55 int test() {
56 struct A a;
57 return a.foo;
58 }
59 }