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 -DTEST5
6 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST6
7 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST7
8 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST8
9 
10 // RUN: cp %s %t
11 // RUN: %clang_cc1 -x c++ %s -std=c++11 -fsyntax-only -verify -DTEST9
12 // RUN: not %clang_cc1 -x c++ %t -std=c++11 -fixit -DTEST9
13 // RUN: %clang_cc1 -x c++ %t -std=c++11 -fsyntax-only -DTEST9
14 
15 #if TEST1
16 
17 // expected-no-diagnostics
18 typedef int Int;
19 typedef char Char;
20 typedef Char* Carp;
21 
22 Int main(Int argc, Carp argv[]) {
23 }
24 
25 #elif TEST2
26 
27 // expected-no-diagnostics
28 typedef int Int;
29 typedef char Char;
30 typedef Char* Carp;
31 
32 Int main(Int argc, Carp argv[], Char *env[]) {
33 }
34 
35 #elif TEST3
36 
37 // expected-no-diagnostics
38 int main() {
39 }
40 
41 #elif TEST4
42 
43 static int main() { // expected-error {{'main' is not allowed to be declared static}}
44 }
45 
46 #elif TEST5
47 
48 inline int main() { // expected-error {{'main' is not allowed to be declared inline}}
49 }
50 
51 #elif TEST6
52 
53 void  // expected-error {{'main' must return 'int'}}
54 main( // expected-error {{first parameter of 'main' (argument count) must be of type 'int'}}
55      float a
56 ) {
57 }
58 
59 #elif TEST7
60 
61 // expected-no-diagnostics
62 int main(int argc, const char* const* argv) {
63 }
64 
65 #elif TEST8
66 
67 template<typename T>
68 int main() { } // expected-error{{'main' cannot be a template}}
69 
70 #elif TEST9
71 
72 constexpr int main() { } // expected-error{{'main' is not allowed to be declared constexpr}}
73 
74 #else
75 
76 #error Unknown test mode
77 
78 #endif
79