[OpenACC] Enable 'attach' clause for combined constructs
[llvm-project.git] / clang / test / Sema / incomplete-decl.c
blobbf2890bba99113b871575d5ab71ae3ee22ad8315
1 // RUN: %clang_cc1 -fsyntax-only -verify=c,expected %s
2 // RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
6 struct foo; // c-note 5 {{forward declaration of 'struct foo'}} \
7 cxx-note 3 {{forward declaration of 'foo'}}
9 void b; // expected-error {{variable has incomplete type 'void'}}
10 struct foo f; // c-error {{tentative definition has type 'struct foo' that is never completed}} \
11 cxx-error {{variable has incomplete type 'struct foo'}}
13 static void c; // expected-error {{variable has incomplete type 'void'}}
14 static struct foo g; // c-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \
15 c-error {{tentative definition has type 'struct foo' that is never completed}} \
16 cxx-error {{variable has incomplete type 'struct foo'}}
18 extern void d; // cxx-error {{variable has incomplete type 'void'}}
19 extern struct foo e;
21 int ary[]; // c-warning {{tentative array definition assumed to have one element}} \
22 cxx-error {{definition of variable with array type needs an explicit size or an initializer}}
23 struct foo bary[]; // c-error {{array has incomplete element type 'struct foo'}} \
24 cxx-error {{definition of variable with array type needs an explicit size or an initializer}}
26 void func(void) {
27 int ary[]; // expected-error {{definition of variable with array type needs an explicit size or an initializer}}
28 void b; // expected-error {{variable has incomplete type 'void'}}
29 struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
32 int h[]; // c-warning {{tentative array definition assumed to have one element}} \
33 cxx-error {{definition of variable with array type needs an explicit size or an initializer}}
34 int (*i)[] = &h+1; // c-error {{arithmetic on a pointer to an incomplete type 'int[]'}}
36 struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
37 c-note {{forward declaration of 'struct bar'}} \
38 cxx-note 2 {{forward declaration of 'bar'}}
40 struct bar k; // cxx-error {{variable has incomplete type 'struct bar'}}
41 struct bar { int a; };
43 struct x y; //c-note 2 {{forward declaration of 'struct x'}} \
44 cxx-error {{variable has incomplete type 'struct x'}} \
45 cxx-note {{forward declaration of 'x'}}
46 void foo() {
47 (void)(1 ? y : y); // c-error 2 {{incomplete type 'struct x' where a complete type is required}}
49 struct x{
50 int a;