1 // RUN: %clang_cc1 -fsyntax-only -verify %s 2 3 struct X { 4 template<typename T, typename U> 5 static void f(int, int); 6 }; 7 8 void f() { 9 void (*ptr)(int, int) = &X::f<int, int>; 10 11 unknown *p = 0; // expected-error {{unknown type name 'unknown'}} 12 unknown * p + 0; // expected-error {{undeclared identifier 'unknown'}} 13 } 14 15 auto (*p)() -> int(nullptr); 16 auto (*q)() -> int(*)(unknown); // expected-error {{unknown type name 'unknown'}} 17 auto (*r)() -> int(*)(unknown + 1); // expected-error {{undeclared identifier 'unknown'}} 18 19 int f(unknown const x); // expected-error {{unknown type name 'unknown'}} 20 21 // Disambiguating an array declarator from an array subscripting. 22 void arr() { 23 int x[] = {1}; // expected-note 2{{previous}} 24 25 // This is array indexing not an array declarator because a comma expression 26 // is not syntactically a constant-expression. 27 int(x[1,1]); // expected-warning {{left operand of comma operator has no effect}} expected-warning {{unused}} 28 29 // This is array indexing not an array declaration because a braced-init-list 30 // is not syntactically a constant-expression. 31 int(x[{0}]); // expected-error {{array subscript is not an integer}} 32 struct A { 33 struct Q { int n; }; 34 int operator[](Q); 35 } a; 36 int(a[{0}]); // expected-warning {{unused}} 37 38 // These are array declarations. 39 int(x[((void)1,1)]); // expected-error {{redefinition}} 40 int(x[true ? 1 : (1,1)]); // expected-error {{redefinition}} // expected-warning {{left operand of comma operator has no effect}} 41 42 int (*_Atomic atomic_ptr_to_int); 43 *atomic_ptr_to_int = 42; 44 } 45