blob: c8d17f0078e66eec7c8df274703bf30c5133bba7 [file] [log] [blame]
Daniel Dunbard7d5f022009-03-24 02:24:46 +00001// RUN: clang-cc -fsyntax-only -verify -pedantic %s
Steve Naroff4a746782008-01-09 22:43:08 +00002
3char *funk(int format);
4enum Test {A=-1};
5char *funk(enum Test x);
6
Chris Lattner5f4a6822008-11-23 23:12:31 +00007int eli(float b); // expected-note {{previous declaration is here}}
Steve Naroffffce4d52008-01-09 23:34:55 +00008int b(int c) {return 1;}
9
Chris Lattner55196442007-11-20 19:04:50 +000010int foo();
Mike Stump1eb44332009-09-09 15:08:12 +000011int foo() {
12 int eli(int (int)); // expected-error {{conflicting types for 'eli'}}
13 eli(b); // expected-error{{incompatible type passing}}
14 return 0;
Chris Lattner55196442007-11-20 19:04:50 +000015}
16
17int bar();
Chris Lattner5f4a6822008-11-23 23:12:31 +000018int bar(int i) // expected-note {{previous definition is here}}
Chris Lattner55196442007-11-20 19:04:50 +000019{
Mike Stump1eb44332009-09-09 15:08:12 +000020 return 0;
Chris Lattner55196442007-11-20 19:04:50 +000021}
Chris Lattner52804082008-02-17 19:31:09 +000022int bar() // expected-error {{redefinition of 'bar'}}
Chris Lattner55196442007-11-20 19:04:50 +000023{
Mike Stump1eb44332009-09-09 15:08:12 +000024 return 0;
Chris Lattner55196442007-11-20 19:04:50 +000025}
26
Chris Lattner5f4a6822008-11-23 23:12:31 +000027int foobar(int); // note {{previous declaration is here}}
Chris Lattnerc41c1232008-11-21 01:05:35 +000028int foobar() // error {{conflicting types for 'foobar'}}
Chris Lattner55196442007-11-20 19:04:50 +000029{
Mike Stump1eb44332009-09-09 15:08:12 +000030 return 0;
Chris Lattner55196442007-11-20 19:04:50 +000031}
32
Chris Lattner5f4a6822008-11-23 23:12:31 +000033int wibble(); // expected-note {{previous declaration is here}}
Steve Naroff837618c2008-01-16 15:01:34 +000034float wibble() // expected-error {{conflicting types for 'wibble'}}
Chris Lattner55196442007-11-20 19:04:50 +000035{
Mike Stump1eb44332009-09-09 15:08:12 +000036 return 0.0f;
Chris Lattner55196442007-11-20 19:04:50 +000037}