PR tree-optimization/81303
[official-gcc.git] / gcc / testsuite / gcc.dg / Wcxx-compat-3.c
blob306167314e8d2bf7debd59e09848831961429c6d
1 /* { dg-do compile } */
2 /* { dg-options "-Wc++-compat" } */
3 enum E1 { A, B, C };
4 enum E2 { D, E, F };
5 extern void f2 (enum E1);
7 void
8 f1 ()
10 int a = A;
11 enum E1 e1;
12 enum E2 e2;
14 f2 (0); /* { dg-warning "invalid in C\[+\]\[+\]" } */
15 f2 (A);
16 f2 (D); /* { dg-warning "invalid in C\[+\]\[+\]" } */
17 f2 (a); /* { dg-warning "invalid in C\[+\]\[+\]" } */
18 f2 (e1);
19 f2 (e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */
20 f2 ((A));
21 f2 (a ? A : B);
22 f2 ((enum E1) 0);
23 f2 ((enum E1) D);
24 f2 ((enum E1) a);
25 f2 ((enum E1) e2);
28 struct s1 { enum E1 e1 : 3; };
29 struct s2 { enum E2 e2 : 3; };
31 void
32 f3 (struct s1 sv1, struct s2 sv2)
34 f2 (sv1.e1);
35 f2 (sv2.e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */
38 void
39 f4 (struct s1 *pv1, struct s2 *pv2)
41 f2 (pv1->e1);
42 f2 (pv2->e2); /* { dg-warning "invalid in C\[+\]\[+\]" } */
45 /* Match all extra informative notes. */
46 /* { dg-message "note: expected '\[^\n'\]*' but argument is of type '\[^\n'\]*'" "note: expected" { target *-*-* } 0 } */