Daily bump.
[official-gcc.git] / gcc / testsuite / gcc.dg / Wcxx-compat-4.c
bloba294ffe0b81d99afc95864946495bc0dc86694d0
1 /* { dg-do compile } */
2 /* { dg-options "-Wc++-compat" } */
3 enum E1 { A, B, C };
4 enum E2 { D, E, F };
6 enum E1 g1;
7 enum E2 g2;
9 void
10 f1 ()
12 int a;
13 int d;
14 enum E1 e1;
15 enum E2 e2;
16 a = A;
17 a = !B;
18 d = E;
19 e1 = A;
20 e1 = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */
21 e1 = 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */
22 e1 = (enum E1) 0;
23 e1 = (enum E2) 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */
24 e1 = e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
25 e1 = g1;
26 e1 = g2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
27 e2 = A; /* { dg-warning "invalid in C\[+\]\[+\]" } */
28 e2 = D;
31 struct s { enum E1 e1 : 3; };
33 void
34 f2 (struct s sv)
36 sv.e1 = A;
37 sv.e1 = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */
38 g1 = sv.e1;
39 g2 = sv.e1; /* { dg-warning "invalid in C\[+\]\[+\]" } */
42 void
43 f3 (struct s *pv)
45 pv->e1 = A;
46 pv->e1 = D; /* { dg-warning "invalid in C\[+\]\[+\]" } */
47 g1 = pv->e1;
48 g2 = pv->e1; /* { dg-warning "invalid in C\[+\]\[+\]" } */