1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits %s 2>&1 | FileCheck %s 3 // RUN: not %clang_cc1 -fsyntax-only -fdiagnostics-parseable-fixits -x c++ %s 2>&1 | FileCheck %s 4 5 // expected-note@+1 5{{previous definition is here}} 6 int main() { 7 return 0; 8 } 9 10 // expected-error@+3 {{conflicting types for 'main}} 11 // expected-warning@+2 {{return type of 'main' is not 'int'}} 12 // expected-note@+1 {{change return type to 'int'}} 13 void main() { 14 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:5}:"int" 15 } 16 17 // expected-error@+3 {{conflicting types for 'main}} 18 // expected-warning@+2 {{return type of 'main' is not 'int'}} 19 // expected-note@+1 {{change return type to 'int'}} 20 double main() { 21 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:7}:"int" 22 return 0.0; 23 } 24 25 // Currently we suggest to replace only 'float' here because we don't store 26 // enough source locations. 27 // 28 // expected-error@+3 {{conflicting types for 'main}} 29 // expected-warning@+2 {{return type of 'main' is not 'int'}} 30 // expected-note@+1 {{change return type to 'int'}} 31 const float main() { 32 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:7-[[@LINE-1]]:12}:"int" 33 return 0.0f; 34 } 35 36 typedef void *(*fptr)(int a); 37 38 // expected-error@+2 {{conflicting types for 'main}} 39 // expected-warning@+1 {{return type of 'main' is not 'int'}} 40 fptr main() { 41 return (fptr) 0; 42 } 43 44 // expected-error@+2 {{conflicting types for 'main}} 45 // expected-warning@+1 {{return type of 'main' is not 'int'}} 46 void *(*main())(int a) { 47 return (fptr) 0; 48 } 49 50