xref: /aosp_15_r20/external/clang/test/Sema/cast-incomplete.c (revision 67e74705e28f6214e480b399dd47ea732279e315)
1*67e74705SXin Li // RUN: %clang_cc1 -fsyntax-only %s -verify
2*67e74705SXin Li // PR5692
3*67e74705SXin Li 
4*67e74705SXin Li enum x;            // expected-note   {{forward declaration}}
5*67e74705SXin Li extern struct y a; // expected-note   {{forward declaration}}
6*67e74705SXin Li extern union z b;  // expected-note 2 {{forward declaration}}
7*67e74705SXin Li 
foo()8*67e74705SXin Li void foo() {
9*67e74705SXin Li   (enum x)1;   // expected-error {{cast to incomplete type}}
10*67e74705SXin Li   (struct y)a; // expected-error {{cast to incomplete type}}
11*67e74705SXin Li   (union z)b;  // expected-error {{cast to incomplete type}}
12*67e74705SXin Li   (union z)1;  // expected-error {{cast to incomplete type}}
13*67e74705SXin Li }
14*67e74705SXin Li 
15