1 /* { dg-do compile } */
2 /* { dg-options "-Wc++-compat" } */
6 enum e1
/* { dg-message "note: enum type defined here" } */
8 A
= sizeof (struct s2
{ int i
; }), /* { dg-warning "invalid in C\[+\]\[+\]" } */
12 struct s2 v1
; /* Don't issue another warning about s2. */
13 enum e1 v2
; /* { dg-warning "not visible in C\[+\]\[+\]" } */
17 C
= sizeof (struct s3
{ int i
; }), /* { dg-warning "invalid in C\[+\]\[+\]" } */
18 D
= __alignof__ (struct s4
{ int i
; }), /* { dg-warning "invalid in C\[+\]\[+\]" } */
27 F
= sizeof (struct t3
), /* { dg-bogus "invalid in C\[+\]\[+\]" } */
28 /* { dg-error "invalid application of 'sizeof'" "" { target *-*-* } .-1 } */
29 G
= __alignof__ (struct t4
), /* { dg-bogus "invalid in C\[+\]\[+\]" } */
30 /* { dg-error "invalid application of '__alignof__'" "" { target *-*-* } .-1 } */
34 __typeof__ (struct s5
{ int i
; }) v5
; /* { dg-warning "invalid in C\[+\]\[+\]" } */
35 __typeof__ (struct t5
) w5
; /* { dg-bogus "invalid in C\[+\]\[+\]" } */
36 /* { dg-error "storage size of 'w5' isn't known" "" { target *-*-* } .-1 } */
41 return ((struct s6
{ int j
; } *) p
)->j
; /* { dg-warning "invalid in C\[+\]\[+\]" } */
47 return ((struct t6
*) p
); /* { dg-bogus "invalid in C\[+\]\[+\]" } */
53 return (__extension__ (struct s7
{ int j
; } *)p
)->j
;
59 return (struct s8
{ int i
; }) { 0 }.i
; /* { dg-warning "invalid in C\[+\]\[+\]" } */
65 return &((struct t8
) { }); /* { dg-warning "invalid in C\[+\]\[+\]" } */
66 /* { dg-error "invalid use of undefined type" "" { target *-*-* } .-1 } */