blob: 4ba97c2a8fdc03e9e1d0f7bf0f4de83f9bccab3c [file] [log] [blame]
Douglas Gregor68719812009-02-16 18:20:44 +00001// RUN: clang -fsyntax-only -verify %s
2
3// PR3588
4void g0(int, int);
5void g0(); // expected-note{{previous declaration is here}}
6
7void f0() {
8 g0(1, 2, 3); // expected-error{{too many arguments to function call}}
9}
10
11void g0(int); // expected-error{{conflicting types for 'g0'}}
12
13int g1(int, int);
14
15typedef int INT;
16
17INT g1(x, y)
18 int x;
19 int y;
20{
21 return x + y;
22}
23
24int g2(int, int); // expected-note{{previous declaration is here}}
25
26INT g2(x) // expected-error{{conflicting types for 'g2'}}
27 int x;
28{
29 return x;
30}
Douglas Gregor04495c82009-02-24 01:23:02 +000031
32void test() {
33 int f1;
34 {
35 void f1(double);
36 {
37 void f1(double); // expected-note{{previous declaration is here}}
38 {
39 int f1(int); // expected-error{{conflicting types for 'f1'}}
40 }
41 }
42 }
43}
44
45extern void g3(int); // expected-note{{previous declaration is here}}
46static void g3(int x) { } // expected-error{{static declaration of 'g3' follows non-static declaration}}
47
48void test2() {
Douglas Gregord6f7e9d2009-02-24 20:03:32 +000049 extern int f2; // expected-note 2 {{previous definition is here}}
Douglas Gregor04495c82009-02-24 01:23:02 +000050 {
51 void f2(int); // expected-error{{redefinition of 'f2' as different kind of symbol}}
52 }
53
54 {
55 int f2;
56 {
Douglas Gregord6f7e9d2009-02-24 20:03:32 +000057 void f2(int); // expected-error{{redefinition of 'f2' as different kind of symbol}}
Douglas Gregor04495c82009-02-24 01:23:02 +000058 }
59 }
60}
Douglas Gregor25d944a2009-02-24 04:26:15 +000061
62// <rdar://problem/6127293>
63int outer1(int); // expected-note{{previous declaration is here}}
64struct outer3 { };
65int outer4(int);
66int outer5; // expected-note{{previous definition is here}}
67int *outer7(int);
68
69void outer_test() {
70 int outer1(float); // expected-error{{conflicting types for 'outer1'}}
71 int outer2(int); // expected-note{{previous declaration is here}}
72 int outer3(int); // expected-note{{previous declaration is here}}
73 int outer4(int); // expected-note{{previous declaration is here}}
74 int outer5(int); // expected-error{{redefinition of 'outer5' as different kind of symbol}}
75 int* outer6(int); // expected-note{{previous declaration is here}}
76 int *outer7(int);
Douglas Gregor63935192009-03-02 00:19:53 +000077 int outer8(int);
Douglas Gregor25d944a2009-02-24 04:26:15 +000078
79 int *ip7 = outer7(6);
80}
81
82int outer2(float); // expected-error{{conflicting types for 'outer2'}}
83int outer3(float); // expected-error{{conflicting types for 'outer3'}}
84int outer4(float); // expected-error{{conflicting types for 'outer4'}}
85
86void outer_test2(int x) {
87 int* ip = outer6(x); // expected-warning{{use of out-of-scope declaration of 'outer6'}}
88 int *ip2 = outer7(x);
89}
Douglas Gregor63935192009-03-02 00:19:53 +000090
91void outer_test3() {
92 int *(*fp)(int) = outer8; // expected-error{{use of undeclared identifier 'outer8'}}
93}
94
95static float outer8(float); // okay