(root)/
gcc-13.2.0/
gcc/
testsuite/
gcc.dg/
Wenum-int-mismatch-3.c
       1  /* PR c/105131 */
       2  /* { dg-do compile } */
       3  /* { dg-options "-Wc++-compat -fno-short-enums" } */
       4  
       5  enum E { E1 = -1, E2 = 0, E3 = 1 };
       6  
       7  int foo(void); /* { dg-message "previous declaration" } */
       8  enum E foo(void) { return E2; } /* { dg-warning "conflicting types" } */
       9  
      10  void bar(int); /* { dg-message "previous declaration" } */
      11  void bar(enum E); /* { dg-warning "conflicting types" } */
      12  
      13  extern int arr[10]; /* { dg-message "previous declaration" } */
      14  extern enum E arr[10]; /* { dg-warning "conflicting types" } */
      15  
      16  extern int i; /* { dg-message "previous declaration" } */
      17  extern enum E i; /* { dg-warning "conflicting types" } */
      18  
      19  extern int *p; /* { dg-message "previous declaration" } */
      20  extern enum E *p; /* { dg-warning "conflicting types" } */
      21  
      22  enum E foo2(void) { return E2; } /* { dg-message "previous definition" } */
      23  int foo2(void); /* { dg-warning "conflicting types" } */
      24  
      25  void bar2(enum E); /* { dg-message "previous declaration" } */
      26  void bar2(int); /* { dg-warning "conflicting types" } */
      27  
      28  extern enum E arr2[10]; /* { dg-message "previous declaration" } */
      29  extern int arr2[10]; /* { dg-warning "conflicting types" } */
      30  
      31  extern enum E i2; /* { dg-message "previous declaration" } */
      32  extern int i2; /* { dg-warning "conflicting types" } */
      33  
      34  extern enum E *p2; /* { dg-message "previous declaration" } */
      35  extern int *p2; /* { dg-warning "conflicting types" } */
      36  
      37  enum F { F1 = -1, F2, F3 } __attribute__ ((__packed__));
      38  
      39  enum F fn1(void); /* { dg-message "previous declaration" } */
      40  signed char fn1(void); /* { dg-warning "conflicting types" } */
      41  
      42  signed char fn2(void); /* { dg-message "previous declaration" } */
      43  enum F fn2(void); /* { dg-warning "conflicting types" } */