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 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST10 16 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST11 17 // RUN: %clang_cc1 -fsyntax-only -verify %s -DTEST12 18 19 #if TEST1 20 21 // expected-no-diagnostics 22 typedef int Int; 23 typedef char Char; 24 typedef Char* Carp; 25 26 Int main(Int argc, Carp argv[]) { 27 } 28 29 #elif TEST2 30 31 // expected-no-diagnostics 32 typedef int Int; 33 typedef char Char; 34 typedef Char* Carp; 35 36 Int main(Int argc, Carp argv[], Char *env[]) { 37 } 38 39 #elif TEST3 40 41 // expected-no-diagnostics 42 int main() { 43 } 44 45 #elif TEST4 46 47 static int main() { // expected-error {{'main' is not allowed to be declared static}} 48 } 49 50 #elif TEST5 51 52 inline int main() { // expected-error {{'main' is not allowed to be declared inline}} 53 } 54 55 #elif TEST6 56 57 void // expected-error {{'main' must return 'int'}} 58 main( // expected-error {{first parameter of 'main' (argument count) must be of type 'int'}} 59 float a 60 ) { 61 } 62 63 #elif TEST7 64 65 // expected-no-diagnostics 66 int main(int argc, const char* const* argv) { 67 } 68 69 #elif TEST8 70 71 template<typename T> 72 int main() { } // expected-error{{'main' cannot be a template}} 73 74 #elif TEST9 75 76 constexpr int main() { } // expected-error{{'main' is not allowed to be declared constexpr}} 77 78 #elif TEST10 79 80 // PR15100 81 // expected-no-diagnostics 82 typedef char charT; 83 int main(int, const charT**) {} 84 85 #elif TEST11 86 87 // expected-no-diagnostics 88 typedef char charT; 89 int main(int, charT* const *) {} 90 91 #elif TEST12 92 93 // expected-no-diagnostics 94 typedef char charT; 95 int main(int, const charT* const *) {} 96 97 #else 98 99 #error Unknown test mode 100 101 #endif 102