PR tree-optimization/83369 - Missing diagnostics during inlining
[official-gcc.git] / gcc / testsuite / gcc.dg / Wcxx-compat-8.c
blob9627dced3472f8de0aa454b3e1a869fd0eb50014
1 /* { dg-do compile } */
2 /* { dg-options "-Wc++-compat" } */
4 struct s1
6 enum e1 /* { dg-message "note: enum type defined here" } */
8 A = sizeof (struct s2 { int i; }), /* { dg-warning "invalid in C\[+\]\[+\]" } */
10 } f1;
12 struct s2 v1; /* Don't issue another warning about s2. */
13 enum e1 v2; /* { dg-warning "not visible in C\[+\]\[+\]" } */
15 enum e2
17 C = sizeof (struct s3 { int i; }), /* { dg-warning "invalid in C\[+\]\[+\]" } */
18 D = __alignof__ (struct s4 { int i; }), /* { dg-warning "invalid in C\[+\]\[+\]" } */
22 struct s3 v3;
23 int v4 = C;
25 enum e3
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 } */
38 int
39 f1 (struct s1 *p)
41 return ((struct s6 { int j; } *) p)->j; /* { dg-warning "invalid in C\[+\]\[+\]" } */
44 void *
45 f2 (struct s1 *p)
47 return ((struct t6 *) p); /* { dg-bogus "invalid in C\[+\]\[+\]" } */
50 int
51 f3 (struct s1 *p)
53 return (__extension__ (struct s7 { int j; } *)p)->j;
56 int
57 f4 ()
59 return (struct s8 { int i; }) { 0 }.i; /* { dg-warning "invalid in C\[+\]\[+\]" } */
62 void *
63 f5 ()
65 return &((struct t8) { }); /* { dg-warning "invalid in C\[+\]\[+\]" } */
66 /* { dg-error "invalid use of undefined type" "" { target *-*-* } .-1 } */