1 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST1 |
2 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST2 |
3 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST3 |
4 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST4 |
5 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST5 |
6 | // RUN: %clang_cc1 -fsyntax-only -verify %s -std=c++14 -DTEST6 |
7 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7 |
8 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8 |
9 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST9 |
10 | // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10 -ffreestanding |
11 | |
12 | #if TEST1 |
13 | int main; // expected-error{{main cannot be declared as global variable}} |
14 | |
15 | #elif TEST2 |
16 | // expected-no-diagnostics |
17 | int f () { |
18 | int main; |
19 | return main; |
20 | } |
21 | |
22 | #elif TEST3 |
23 | // expected-no-diagnostics |
24 | void x(int main) {}; |
25 | int y(int main); |
26 | |
27 | #elif TEST4 |
28 | // expected-no-diagnostics |
29 | class A { |
30 | static int main; |
31 | }; |
32 | |
33 | #elif TEST5 |
34 | // expected-no-diagnostics |
35 | template<class T> constexpr T main; |
36 | |
37 | #elif TEST6 |
38 | extern template<class T> constexpr T main; //expected-error{{expected unqualified-id}} |
39 | |
40 | #elif TEST7 |
41 | // expected-no-diagnostics |
42 | namespace foo { |
43 | int main; |
44 | } |
45 | |
46 | #elif TEST8 |
47 | void z(void) |
48 | { |
49 | extern int main; // expected-error{{main cannot be declared as global variable}} |
50 | } |
51 | |
52 | #elif TEST9 |
53 | // expected-no-diagnostics |
54 | int q(void) |
55 | { |
56 | static int main; |
57 | return main; |
58 | } |
59 | |
60 | #elif TEST10 |
61 | // expected-no-diagnostics |
62 | int main; |
63 | |
64 | #else |
65 | #error Unknown Test |
66 | #endif |
67 | |