1 // RUN: clang-cc -fsyntax-only -verify -pedantic-errors %s
2 
3 void f() {
4   int a;
5   struct S { int m; };
6   typedef S *T;
7 
8   // Expressions.
9   T(a)->m = 7;
10   int(a)++; // expected-error {{expression is not assignable}}
11   __extension__ int(a)++; // expected-error {{expression is not assignable}}
12   __typeof(int)(a,5)<<a; // expected-error {{function-style cast to a builtin type can only take one argument}}
13   void(a), ++a; // expected-warning {{expression result unused}}
14   if (int(a)+1) {}
15   for (int(a)+1;;) {} // expected-warning {{expression result unused}}
16   a = sizeof(int()+1);
17   a = sizeof(int(1));
18   typeof(int()+1) a2; // expected-error {{extension used}}
19   (int(1)); // expected-warning {{expression result unused}}
20 
21   // type-id
22   (int())1; // expected-error {{C-style cast from 'int' to 'int ()' is not allowed}}
23 
24   // Declarations.
25   int fd(T(a)); // expected-warning {{parentheses were disambiguated as a function declarator}}
26   T(*d)(int(p)); // expected-warning {{parentheses were disambiguated as a function declarator}} expected-note {{previous definition is here}}
27   T(d)[5]; // expected-error {{redefinition of 'd'}}
28   typeof(int[])(f) = { 1, 2 }; // expected-error {{extension used}}
29   void(b)(int);
30   int(d2) __attribute__(());
31   if (int(a)=1) {}
32   int(d3(int()));
33 }
34 
35 class C { };
36 void fn(int(C)) { } // void fn(int(*fp)(C c)) { } expected-note{{candidate function}}
37                     // not: void fn(int C);
38 int g(C);
39 
40 void foo() {
41   fn(1); // expected-error {{no matching function}}
42   fn(g); // OK
43 }
44