aditya-pixel

D144358 [LLVM-LIT-TEST]

Mar 8th, 2023
136
0
Never
1
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.88 KB | Source Code | 0 0
  1. // RUN: %clang_cc1 -fsyntax-only -verify=expected %s
  2. // RUN: %clang_cc1 -x c++ -fsyntax-only -verify=cxx,expected %s
  3.  
  4.  
  5.  
  6. struct foo; // expected-note 5 {{forward declaration of 'struct foo'}}
  7.  
  8. void b;  // expected-error {{variable has incomplete type 'void'}}
  9. struct foo f; // expected-error{{tentative definition has type 'struct foo' that is never completed}}
  10.  
  11. static void c; // expected-error {{variable has incomplete type 'void'}}
  12. static struct foo g;  // expected-warning {{tentative definition of variable with internal linkage has incomplete non-array type 'struct foo'}} \
  13.     expected-error{{tentative definition has type 'struct foo' that is never completed}}
  14.  
  15. extern void d;
  16. extern struct foo e;
  17.  
  18. int ary[]; // expected-warning {{tentative array definition assumed to have one element}}
  19. struct foo bary[]; // expected-error {{array has incomplete element type 'struct foo'}}
  20.  
  21. void func(void) {
  22.   int ary[]; // expected-error{{definition of variable with array type needs an explicit size or an initializer}}
  23.   void b; // expected-error {{variable has incomplete type 'void'}}
  24.   struct foo f; // expected-error {{variable has incomplete type 'struct foo'}}
  25. }
  26.  
  27. int h[]; // expected-warning {{tentative array definition assumed to have one element}}
  28. int (*i)[] = &h+1; // expected-error {{arithmetic on a pointer to an incomplete type 'int[]'}}
  29.  
  30. struct bar j = {1}; // expected-error {{variable has incomplete type 'struct bar'}} \
  31.     expected-note {{forward declaration of 'struct bar'}}
  32. struct bar k;
  33. struct bar { int a; };
  34. struct x y; //expected-note {{forward declaration of 'struct x'}} \
  35. //expected-note {{forward declaration of 'struct x'}}
  36. void foo() {
  37.   (void)(1 ? y : y); // expected-error {{incomplete type 'struct x' where a complete type is required}} \
  38.       expected-error {{incomplete type 'struct x' where a complete type is required}}
  39. }
  40. struct x{
  41.   int a;
  42. };
Advertisement
Comments
  • aditya-pixel
    3 years
    # C++ 5.18 KB | 0 0
    1. //LIT RESULTS
    2. 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
    3. -- Testing: 1 tests, 1 workers --
    4. FAIL: Clang :: Sema/incomplete-decl.c (1 of 1)
    5. ******************** TEST 'Clang :: Sema/incomplete-decl.c' FAILED ********************
    6. Script:
    7. --
    8. : '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
    9. : '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
    10. --
    11. Exit Code: 1
    12.  
    13. Command Output (stderr):
    14. --
    15. error: 'error' diagnostics expected but not seen:
    16.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 9: tentative definition has type 'struct foo' that is never completed
    17.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 12: tentative definition has type 'struct foo' that is never completed
    18.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 19: array has incomplete element type 'struct foo'
    19.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 28: arithmetic on a pointer to an incomplete type 'int[]'
    20.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 37: incomplete type 'struct x' where a complete type is required
    21.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 37: incomplete type 'struct x' where a complete type is required
    22. error: 'error' diagnostics seen but not expected:
    23.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 9: variable has incomplete type 'struct foo'
    24.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 12: variable has incomplete type 'struct foo'
    25.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 15: variable has incomplete type 'void'
    26.   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
    27.   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
    28.   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
    29.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 32: variable has incomplete type 'struct bar'
    30.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: variable has incomplete type 'struct x'
    31. error: 'warning' diagnostics expected but not seen:
    32.   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'
    33.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 18: tentative array definition assumed to have one element
    34.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 27: tentative array definition assumed to have one element
    35. error: 'note' diagnostics expected but not seen:
    36.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
    37.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
    38.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
    39.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
    40.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'struct foo'
    41.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 30: forward declaration of 'struct bar'
    42.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: forward declaration of 'struct x'
    43.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: forward declaration of 'struct x'
    44. error: 'note' diagnostics seen but not expected:
    45.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'foo'
    46.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'foo'
    47.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 6: forward declaration of 'foo'
    48.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 30: forward declaration of 'bar'
    49.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 30: forward declaration of 'bar'
    50.   File /home/aditya-singh/llvm-project/clang/test/Sema/incomplete-decl.c Line 34: forward declaration of 'x'
    51. 31 errors generated.
    52.  
    53. --
    54.  
    55. ********************
    56. ********************
    57.  
Add Comment
Please, Sign In to add comment