blob: 8a4eafc1325cf5fbc7520aa6de6bd1fc1751e4ed [file] [log] [blame]
Dmitri Gribenko445743d2013-01-21 11:25:03 +00001// RUN: %clang_cc1 -fsyntax-only -verify %s
2// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s
3// RUN: %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s
4
5// expected-note@+1 2{{previous definition is here}}
6int main() {
7 return 0;
8}
9
10// expected-error@+2 {{static declaration of 'main' follows non-static declaration}}
11// expected-warning@+1 {{'main' should not be declared static}}
12static int main() {
13// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:""
14 return 0;
15}
16
17// expected-error@+3 {{redefinition of 'main'}}
18// expected-error@+2 {{'main' is not allowed to be declared inline}}
19// expected-note@+1 {{previous definition is here}}
20inline int main() {
21// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:8}:""
22 return 0;
23}
24
Richard Smithe6738d82013-01-30 06:27:44 +000025// expected-warning@+6 {{function 'main' declared 'noreturn' should not return}}
Dmitri Gribenko445743d2013-01-21 11:25:03 +000026// expected-error@+3 {{redefinition of 'main'}}
27// expected-warning@+2 {{'main' is not allowed to be declared _Noreturn}}
28// expected-note@+1 {{remove '_Noreturn'}}
29_Noreturn int main() {
30// CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:11}:""
31 return 0;
32}
33