• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // RUN: %clang_cc1 -verify %s -pedantic-errors
2 // RUN: %clang_cc1 -verify %s -pedantic-errors -DINLINE
3 // RUN: %clang_cc1 -verify %s -pedantic-errors -DSTATIC
4 // RUN: %clang_cc1 -verify %s -pedantic-errors -std=c++11 -DCONSTEXPR
5 // RUN: %clang_cc1 -verify %s -std=c++11 -DDELETED
6 
7 #if INLINE
8 inline // expected-error {{'main' is not allowed to be declared inline}}
9 #elif STATIC
10 static // expected-error {{'main' is not allowed to be declared static}}
11 #elif CONSTEXPR
12 constexpr // expected-error {{'main' is not allowed to be declared constexpr}}
13 #endif
14 int main(int argc, char **argv)
15 #if DELETED
16   = delete; // expected-error {{'main' is not allowed to be deleted}}
17 #else
18 {
19   int (*pmain)(int, char**) = &main; // expected-error {{ISO C++ does not allow 'main' to be used by a program}}
20 
21   if (argc)
22     main(0, 0); // expected-error {{ISO C++ does not allow 'main' to be used by a program}}
23 }
24 #endif
25