(root)/
gcc-13.2.0/
gcc/
testsuite/
c-c++-common/
pr53874.c
       1  /* PR c/53874 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-Wswitch-enum" } */
       4  
       5  enum E { A, B, C };
       6  struct S { enum E e:2; };
       7  typedef struct S TS;
       8  
       9  int
      10  fn0 (struct S *s)
      11  {
      12    switch (s->e) /* { dg-warning "enumeration value .C. not handled in switch" } */
      13      {
      14      case A:
      15        return 1;
      16      case B:
      17        return 2;
      18      default:
      19        return 0;
      20      }
      21  }
      22  
      23  int
      24  fn1 (TS *s)
      25  {
      26    switch (s->e) /* { dg-warning "enumeration value .C. not handled in switch" } */
      27      {
      28      case A:
      29        return 1;
      30      case B:
      31        return 2;
      32      default:
      33        return 0;
      34      }
      35  }