blob: d7b2f96a6be8981a3e4355f7d2ab7f9819973996 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
|
/* { dg-do compile } */
/* { dg-options "-Wc++-compat" } */
enum E1 { A, B, C };
enum E2 { D, E, F };
int f1() { return A; }
struct s { enum E1 e1 : 3; enum E2 e2 : 4; };
enum E1
f2 (int i, struct s sv, struct s *pv)
{
int a;
enum E1 e1 = B;
enum E2 e2 = E;
switch (i)
{
case 0:
return A;
case 1:
return D; /* { dg-warning "invalid in C\[+\]\[+\]" } */
case 2:
return 0; /* { dg-warning "invalid in C\[+\]\[+\]" } */
case 3:
return (enum E1) 1;
case 4:
return (enum E2) 2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
case 5:
return e1;
case 6:
return e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
case 7:
return pv->e1;
case 8:
return sv.e1;
case 9:
return pv->e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
case 10:
return sv.e2; /* { dg-warning "invalid in C\[+\]\[+\]" } */
case 11:
return 1, A;
default:
return C;
}
}
|