Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / CXX / basic / basic.start / basic.start.main / p3.cpp
blobf7085ca31d6c907e805e929bd117f6e5d7a35cd9
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
12 #if TEST1
13 int main; // expected-error{{main cannot be declared as global variable}}
15 #elif TEST2
16 // expected-no-diagnostics
17 int f () {
18 int main;
19 return main;
22 #elif TEST3
23 // expected-no-diagnostics
24 void x(int main) {};
25 int y(int main);
27 #elif TEST4
28 // expected-no-diagnostics
29 class A {
30 static int main;
33 #elif TEST5
34 // expected-no-diagnostics
35 template<class T> constexpr T main;
37 #elif TEST6
38 extern template<class T> constexpr T main; //expected-error{{expected unqualified-id}}
40 #elif TEST7
41 // expected-no-diagnostics
42 namespace foo {
43 int main;
46 #elif TEST8
47 void z(void)
49 extern int main; // expected-error{{main cannot be declared as global variable}}
52 #elif TEST9
53 // expected-no-diagnostics
54 int q(void)
56 static int main;
57 return main;
60 #elif TEST10
61 // expected-no-diagnostics
62 int main;
64 #else
65 #error Unknown Test
66 #endif