Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // RUN: %clang_cc1 -fsyntax-only -verify=expected %s
- // RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
- struct foo; // expected-note 5 {{forward declaration of 'struct foo'}}
- void b; // expected-error {{variable has incomplete type 'void'}}
- struct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}}
- static void c; // expected-error {{variable has incomplete type 'void'}}
- static struct foo g; // expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \
- expected-error{{tentative definition has type 'struct foo' that is never completed}}
- extern void d;
- extern struct foo e;
- int ary[]; // expected-warning {{tentative array definition assumed to have one element}}
- struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}}
- void func(void) {
- int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}}
- void b; // expected-error {{variable has incomplete type 'void'}}
- struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
- }
- int h[]; // expected-warning {{tentative array definition assumed to have one element}}
- int (*i)[] = &h+1; // expected-error {{arithmetic on a pointer to an incomplete type 'int[]'}}
- struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
- expected-note {{forward declaration of 'struct bar'}}
- struct bar k;
- struct bar { int a; };
- struct x y; //expected-note {{forward declaration of 'struct x'}} \
- //expected-note {{forward declaration of 'struct x'}}
- void foo() {
- (void)(1 ? y : y); // expected-error {{incomplete type 'struct x' where a complete type is required}} \
- expected-error {{incomplete type 'struct x' where a complete type is required}}
- }
- struct x{
- int a;
- };
Advertisement
Comments
-
- //LIT RESULTS
- llvm-lit: /home/aditya-singh/llvm-project/llvm/utils/lit/lit/llvm/config.py:459: note: using clang: /home/aditya-singh/llvm-project/build/bin/clang
- -- Testing: 1 tests, 1 workers --
- FAIL: Clang :: Sema/incomplete-decl.c (1 of 1)
- ******************** TEST 'Clang :: Sema/incomplete-decl.c' FAILED ********************
- Script:
- --
- : 'RUN: at line 1'; /home/aditya-singh/llvm-project/build/bin/clang -cc1 -internal-isystem /home/aditya-singh/llvm-project/build/lib/clang/17/include -nostdsysteminc -fsyntax-only -verify=expected /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c
- : 'RUN: at line 2'; /home/aditya-singh/llvm-project/build/bin/clang -cc1 -internal-isystem /home/aditya-singh/llvm-project/build/lib/clang/17/include -nostdsysteminc -x c++ -fsyntax-only -verify=cxx,expected /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c
- --
- Exit Code: 1
- Command Output (stderr):
- --
- error: 'error' diagnostics expected but not seen:
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 9: tentative definition has type 'struct foo' that is never completed
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 12: tentative definition has type 'struct foo' that is never completed
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 19: array has incomplete element type 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 28: arithmetic on a pointer to an incomplete type 'int[]'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 37: incomplete type 'struct x' where a complete type is required
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 37: incomplete type 'struct x' where a complete type is required
- error: 'error' diagnostics seen but not expected:
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 9: variable has incomplete type 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 12: variable has incomplete type 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 15: variable has incomplete type 'void'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 18: definition of variable with array type needs an explicit size or an initializer
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 19: definition of variable with array type needs an explicit size or an initializer
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 27: definition of variable with array type needs an explicit size or an initializer
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 32: variable has incomplete type 'struct bar'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: variable has incomplete type 'struct x'
- error: 'warning' diagnostics expected but not seen:
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 12: tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 18: tentative array definition assumed to have one element
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 27: tentative array definition assumed to have one element
- error: 'note' diagnostics expected but not seen:
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 30: forward declaration of 'struct bar'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: forward declaration of 'struct x'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: forward declaration of 'struct x'
- error: 'note' diagnostics seen but not expected:
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'foo'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 30: forward declaration of 'bar'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 30: forward declaration of 'bar'
- File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: forward declaration of 'x'
- 31 errors generated.
- --
- ********************
- ********************
Add Comment
Please, Sign In to add comment