Revert "[llvm] Improve llvm.objectsize computation by computing GEP, alloca and mallo...
[llvm-project.git] / clang / test / Parser / cxx-ambig-decl-expr.cpp
blobf61514020f38a99473ede573d47847c42186b4d3
1 // RUN: %clang_cc1 -fsyntax-only -verify %s
3 struct X {
4 template<typename T, typename U>
5 static void f(int, int);
6 };
8 void f() {
9 void (*ptr)(int, int) = &X::f<int, int>;
11 unknown *p = 0; // expected-error {{unknown type name 'unknown'}}
12 unknown * p + 0; // expected-error {{undeclared identifier 'unknown'}}
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'}}
19 int f(unknown const x); // expected-error {{unknown type name 'unknown'}}
21 // Disambiguating an array declarator from an array subscripting.
22 void arr() {
23 int x[] = {1}; // expected-note 2{{previous}}
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}}
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}}
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}}
42 int (*_Atomic atomic_ptr_to_int);
43 *atomic_ptr_to_int = 42;
46 namespace function_with_trailing {
47 struct Foo {
48 Foo(int);
50 template <typename T> void bar()
51 { Foo _(T::method()->mem()); }