brintos

brintos / llvm-project-archived public Read only

0
0
Text · 1.7 KiB · f615140 Raw
53 lines · cpp
1// RUN: %clang_cc1 -fsyntax-only -verify %s2 3struct X {4  template<typename T, typename U>5  static void f(int, int);6};7 8void 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 15auto (*p)() -> int(nullptr);16auto (*q)() -> int(*)(unknown); // expected-error {{unknown type name 'unknown'}}17auto (*r)() -> int(*)(unknown + 1); // expected-error {{undeclared identifier 'unknown'}}18 19int f(unknown const x); // expected-error {{unknown type name 'unknown'}}20 21// Disambiguating an array declarator from an array subscripting.22void arr() {23  int x[] = {1}; // expected-note 2{{previous}}24 25  // This is array indexing not an array declarator because a comma expression26  // 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-list30  // 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 46namespace function_with_trailing {47struct Foo {48  Foo(int);49};50template <typename T> void bar()51  { Foo _(T::method()->mem()); }52}53