blob: 38536e646f234b3d2362a2e32e979cf8d8af8578 [file] [log] [blame]
Richard Smithe1564ea2013-01-29 02:42:09 +00001// 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
18typedef int Int;
19typedef char Char;
20typedef Char* Carp;
21
22Int main(Int argc, Carp argv[]) {
23}
24
25#elif TEST2
26
27// expected-no-diagnostics
28typedef int Int;
29typedef char Char;
30typedef Char* Carp;
31
32Int main(Int argc, Carp argv[], Char *env[]) {
33}
34
35#elif TEST3
36
37// expected-no-diagnostics
38int main() {
39}
40
41#elif TEST4
42
43static int main() { // expected-error {{'main' is not allowed to be declared static}}
44}
45
46#elif TEST5
47
48inline int main() { // expected-error {{'main' is not allowed to be declared inline}}
49}
50
51#elif TEST6
52
53void // expected-error {{'main' must return 'int'}}
54main( // 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
62int main(int argc, const char* const* argv) {
63}
64
65#elif TEST8
66
67template<typename T>
68int main() { } // expected-error{{'main' cannot be a template}}
69
70#elif TEST9
71
72constexpr int main() { } // expected-error{{'main' is not allowed to be declared constexpr}}
73
74#else
75
76#error Unknown test mode
77
78#endif