1 // RUN: %clang_cc1 -Wno-int-to-pointer-cast -fsyntax-only -verify -pedantic-errors %s
2 // RUN: %clang_cc1 -Wno-int-to-pointer-cast -fsyntax-only -verify -pedantic-errors -x objective-c++ %s
11 int(a)++; // expected-error {{assignment to cast is illegal}}
12 __extension__ int(a)++; // expected-error {{assignment to cast is illegal}}
13 __typeof(int)(a,5)<<a; // expected-error {{excess elements in scalar initializer}}
16 for (int(a)+1;;) {} // expected-warning {{expression result unused}}
19 typeof(int()+1) a2; // expected-error {{extension used}}
20 (int(1)); // expected-warning {{expression result unused}}
23 (int())1; // expected-error {{C-style cast from 'int' to 'int ()' is not allowed}}
26 int fd(T(a)); // expected-warning {{disambiguated as a function declaration}} expected-note{{add a pair of parentheses}}
27 T(*d)(int(p)); // expected-note {{previous}}
30 T d3(); // expected-warning {{empty parentheses interpreted as a function declaration}} expected-note {{replace parentheses with an initializer}}
34 __typeof(*T()) f4(); // expected-warning {{empty parentheses interpreted as a function declaration}} expected-note {{replace parentheses with an initializer}}
38 multi2(); // expected-warning {{empty parentheses interpreted as a function declaration}} expected-note {{replace parentheses with an initializer}}
39 T(d)[5]; // expected-error {{redefinition of 'd'}}
40 typeof(int[])(f) = { 1, 2 }; // expected-error {{extension used}}
42 int(d2) __attribute__(());
58 RAII raii(); // expected-warning {{function declaration}} expected-note {{remove parentheses to declare a variable}}
59 int a, b, c, d, e, // expected-note {{change this ',' to a ';' to call 'func'}}
60 func(); // expected-warning {{function declaration}} expected-note {{replace parentheses with an initializer}}
62 S s(); // expected-warning {{function declaration}}
64 void nonEmptyParens() {
65 int f = 0, // g = 0; expected-note {{change this ',' to a ';' to call 'func2'}}
66 func2(short(f)); // expected-warning {{function declaration}} expected-note {{add a pair of parentheses}}
71 void fn(int(C)) { } // void fn(int(*fp)(C c)) { } expected-note{{candidate function}}
72 // not: void fn(int C);
76 fn(1); // expected-error {{no matching function}}
81 void foo(); // expected-note 3 {{class 'foo' is hidden by a non-type declaration of 'foo' here}}
85 const foo* f1 = 0; // expected-error {{must use 'class' tag to refer to type 'foo' in this scope}}
86 foo* f2 = 0; // expected-error {{must use 'class' tag to refer to type 'foo' in this scope}}
87 foo f3; // expected-error {{must use 'class' tag to refer to type 'foo' in this scope}}
91 int baz; // expected-note 2 {{class 'baz' is hidden by a non-type declaration of 'baz' here}}
94 const baz* b1 = 0; // expected-error {{must use 'class' tag to refer to type 'baz' in this scope}}
95 baz* b2; // expected-error {{use of undeclared identifier 'b2'}}
96 baz b3; // expected-error {{must use 'class' tag to refer to type 'baz' in this scope}}