blob: a1d7137796045b26eec86476ac7d58799ffb57bf [file] [log] [blame]
Chris Lattner871fd792008-02-10 23:08:00 +00001// RUN: clang %s -fsyntax-only -verify -pedantic
Chris Lattnerc08564a2008-01-02 22:50:48 +00002// PR1892
3void f(double a[restrict][5]); // should promote to restrict ptr.
4void f(double (* restrict a)[5]);
5
Steve Naroffdec17fe2008-01-29 00:15:50 +00006int foo (__const char *__path);
7int foo(__const char *__restrict __file);
8
Chris Lattner1336cab2008-11-23 23:12:31 +00009void func(const char*); // expected-note {{previous declaration is here}}
10void func(char*); // expected-error{{conflicting types for 'func'}}
Steve Naroff577f9722008-01-29 18:58:14 +000011
Chris Lattnerc38d4522008-01-14 05:45:46 +000012void g(int (*)(const void **, const void **));
13void g(int (*compar)()) {
14}
15
Chris Lattner1336cab2008-11-23 23:12:31 +000016void h(); // expected-note {{previous declaration is here}}
17void h (const char *fmt, ...) {} // expected-error{{conflicting types for 'h'}}
Chris Lattner25166a02008-01-31 06:06:29 +000018
19// PR1965
20int t5(b); // expected-error {{parameter list without types}}
Chris Lattner6ab935b2008-04-05 06:32:51 +000021int t6(int x, g); // expected-warning {{type specifier missing, defaults to 'int'}}
Chris Lattner25166a02008-01-31 06:06:29 +000022
Chris Lattner871fd792008-02-10 23:08:00 +000023int t7(, ); // expected-error {{expected parameter declarator}} expected-error {{expected parameter declarator}}
24int t8(, int a); // expected-error {{expected parameter declarator}}
25int t9(int a, ); // expected-error {{expected parameter declarator}}
Chris Lattner25166a02008-01-31 06:06:29 +000026
27
Chris Lattnerec9361f2008-02-17 19:31:09 +000028// PR2042
29void t10(){}
30void t11(){t10(1);}
31
Chris Lattnerb0b42f62008-12-17 07:32:46 +000032// PR3208
33void t12(int) {} // expected-error{{parameter name omitted}}
34
Chris Lattner6ed167c2008-12-18 02:01:17 +000035// PR2790
36void t13() {
37 return 0; // expected-warning {{void function 't13' should not return a value}}
38}
39int t14() {
40 return; // expected-warning {{non-void function 't14' should return a value}}
41}
Douglas Gregor65075ec2009-01-23 16:23:13 +000042
43// <rdar://problem/6097326>
44y(y) { return y; } // expected-warning{{parameter 'y' was not declared, defaulting to type 'int'}} \
45 // expected-warning{{type specifier missing, defaults to 'int'}}
Eli Friedmanbbb58d02009-02-04 18:50:00 +000046
47
Douglas Gregor1b3d6b72009-02-04 19:10:27 +000048// PR3137, <rdar://problem/6127293>
Eli Friedmanbbb58d02009-02-04 18:50:00 +000049extern int g0_3137(void);
50void f0_3137() {
51 int g0_3137(void);
52}
53void f1_3137() {
54 int (*fp)(void) = g0_3137;
55}
Douglas Gregoraf682022009-02-24 01:23:02 +000056
57void f1static() {
58 static void f2static(int); // expected-error{{function declared in block scope cannot have 'static' storage class}}
59 register void f2register(int); // expected-error{{illegal storage class on function}}
60}