blob: 1c40b6e8c2c0ec30f1c9fa3f7733ed4f5d352d89 [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
Douglas Gregor4f4946a2010-04-22 00:20:18 +00007int eli(float b); // expected-note {{previous declaration is here}} \
8// expected-note{{passing argument to parameter 'b' here}}
Steve Naroffe6b0ec82008-01-09 23:34:55 +00009int b(int c) {return 1;}
10
Chris Lattner5c3f1542007-11-20 19:04:50 +000011int foo();
Mike Stump11289f42009-09-09 15:08:12 +000012int foo() {
13 int eli(int (int)); // expected-error {{conflicting types for 'eli'}}
Douglas Gregorc68e1402010-04-09 00:35:39 +000014 eli(b); // expected-error{{passing 'int (int)' to parameter of incompatible type 'float'}}
Mike Stump11289f42009-09-09 15:08:12 +000015 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000016}
17
18int bar();
Chris Lattner0369c572008-11-23 23:12:31 +000019int bar(int i) // expected-note {{previous definition is here}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000020{
Mike Stump11289f42009-09-09 15:08:12 +000021 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000022}
Chris Lattnerb080ed52008-02-17 19:31:09 +000023int bar() // expected-error {{redefinition of 'bar'}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000024{
Mike Stump11289f42009-09-09 15:08:12 +000025 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000026}
27
Chris Lattner0369c572008-11-23 23:12:31 +000028int foobar(int); // note {{previous declaration is here}}
Chris Lattner66c8beb2008-11-21 01:05:35 +000029int foobar() // error {{conflicting types for 'foobar'}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000030{
Mike Stump11289f42009-09-09 15:08:12 +000031 return 0;
Chris Lattner5c3f1542007-11-20 19:04:50 +000032}
33
Chris Lattner0369c572008-11-23 23:12:31 +000034int wibble(); // expected-note {{previous declaration is here}}
Steve Naroff17832a42008-01-16 15:01:34 +000035float wibble() // expected-error {{conflicting types for 'wibble'}}
Chris Lattner5c3f1542007-11-20 19:04:50 +000036{
Mike Stump11289f42009-09-09 15:08:12 +000037 return 0.0f;
Chris Lattner5c3f1542007-11-20 19:04:50 +000038}