blob: 74bc86fa57073ef5a6ab540ec3ae9160eaac123a [file] [log] [blame]
Daniel Dunbar8fbe78f2009-12-15 20:14:24 +00001// RUN: %clang_cc1 -fsyntax-only -verify -pedantic %s
Steve Naroffc6edcbd2008-01-09 22:43:08 +00002
3char *funk(int format);
4enum Test {A=-1};
5char *funk(enum Test x);
6
Chris Lattner0369c572008-11-23 23:12:31 +00007int eli(float b); // expected-note {{previous declaration is here}}
Steve Naroffe6b0ec82008-01-09 23:34:55 +00008int b(int c) {return 1;}
9
Chris Lattner5c3f1542007-11-20 19:04:50 +000010int foo();
Mike Stump11289f42009-09-09 15:08:12 +000011int foo() {
12 int eli(int (int)); // expected-error {{conflicting types for 'eli'}}
Douglas Gregorc68e1402010-04-09 00:35:39 +000013 eli(b); // expected-error{{passing 'int (int)' to parameter of incompatible type 'float'}}
Mike Stump11289f42009-09-09 15:08:12 +000014 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000015}
16
17int bar();
Chris Lattner0369c572008-11-23 23:12:31 +000018int bar(int i) // expected-note {{previous definition is here}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000019{
Mike Stump11289f42009-09-09 15:08:12 +000020 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000021}
Chris Lattnerb080ed52008-02-17 19:31:09 +000022int bar() // expected-error {{redefinition of 'bar'}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000023{
Mike Stump11289f42009-09-09 15:08:12 +000024 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000025}
26
Chris Lattner0369c572008-11-23 23:12:31 +000027int foobar(int); // note {{previous declaration is here}}
Chris Lattner66c8beb2008-11-21 01:05:35 +000028int foobar() // error {{conflicting types for 'foobar'}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000029{
Mike Stump11289f42009-09-09 15:08:12 +000030 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000031}
32
Chris Lattner0369c572008-11-23 23:12:31 +000033int wibble(); // expected-note {{previous declaration is here}}
Steve Naroff17832a42008-01-16 15:01:34 +000034float wibble() // expected-error {{conflicting types for 'wibble'}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000035{
Mike Stump11289f42009-09-09 15:08:12 +000036 return 0.0f;
Chris Lattner5c3f1542007-11-20 19:04:50 +000037}