summaryrefslogtreecommitdiff
path: root/gcc/testsuite/c-c++-common/pr53874.c
blob: 153f997c6e901e197f1e545c780bd5d7e46f60c8 (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
/* PR c/53874 */
/* { dg-do compile } */
/* { dg-options "-Wswitch-enum" } */

enum E { A, B, C };
struct S { enum E e:2; };
typedef struct S TS;

int
fn0 (struct S *s)
{
  switch (s->e) /* { dg-warning "enumeration value .C. not handled in switch" } */
    {
    case A:
      return 1;
    case B:
      return 2;
    default:
      return 0;
    }
}

int
fn1 (TS *s)
{
  switch (s->e) /* { dg-warning "enumeration value .C. not handled in switch" } */
    {
    case A:
      return 1;
    case B:
      return 2;
    default:
      return 0;
    }
}