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