Home | History | Annotate | Download | only in Sema
      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 // TODO: Store qualifier source locations for return types so
     26 // we can replace the full type with this fix-it.
     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@+3 {{conflicting types for 'main}}
     39 // expected-warning@+2 {{return type of 'main' is not 'int'}}
     40 // expected-note@+1 {{change return type to 'int'}}
     41 fptr main() {
     42 // CHECK: fix-it:"{{.*}}":{[[@LINE-1]]:1-[[@LINE-1]]:5}:"int"
     43   return (fptr) 0;
     44 }
     45 
     46 // expected-error@+2 {{conflicting types for 'main}}
     47 // expected-warning@+1 {{return type of 'main' is not 'int'}}
     48 void *(*main())(int a) {
     49   return (fptr) 0;
     50 }
     51 
     52