[clang] Implement lifetime analysis for lifetime_capture_by(X) (#115921)
[llvm-project.git] / clang / test / Sema / prototype-redecls.c
blob49305db10d240a266b133d3a1722c117e8faa7da
1 // RUN: %clang_cc1 -fsyntax-only -Wno-strict-prototypes -verify %s
3 void blapp(int); // expected-note {{previous}}
4 void blapp() { } // expected-error {{conflicting types for 'blapp'}}
6 void yarp(int, ...); // expected-note {{previous}}
7 void yarp(); // expected-error {{conflicting types for 'yarp'}}
9 void blarg(int, ...); // expected-note {{previous}}
10 void blarg() {} // expected-error {{conflicting types for 'blarg'}}
12 void blerp(short); // expected-note {{previous}}
13 void blerp(x) int x; {} // expected-error {{conflicting types for 'blerp'}}
15 void foo(int); // expected-note {{previous}}
16 void foo();
17 void foo() {} // expected-error {{conflicting types for 'foo'}}
19 void glerp(int);
20 void glerp(x) short x; {} // Okay, promoted type is fine
22 // All these cases are okay
23 void derp(int);
24 void derp(x) int x; {}
26 void garp(int);
27 void garp();
28 void garp(x) int x; {}
30 // Ensure redeclarations that conflict with a builtin use a note which makes it
31 // clear that the previous declaration was a builtin.
32 float rintf() { // expected-warning {{incompatible redeclaration of library function 'rintf'}} \
33 expected-note {{'rintf' is a builtin with type 'float (float)'}}
34 return 1.0f;