1 /* PR 30260 */ 2 /* { dg-do link } */ 3 /* { dg-options "-pedantic -O" } */ 4 #include <limits.h> 5 6 enum A { 7 A1 = 0, 8 A2 = A1 - 1 9 }; 10 enum B { 11 B1 = 0u, 12 B2 = B1 - 1 /* { dg-bogus "ISO C restricts enumerator values to range of 'int'" } */ 13 }; main(void)14int main(void) 15 { 16 enum A a = -1; 17 enum B b = -1; 18 19 if (!(a < 0)) 20 link_error (); 21 if (!(A2 < 0)) 22 link_error (); 23 if (!(b < 0)) 24 link_error (); 25 if (!(B2 < 0)) 26 link_error (); 27 28 return 0; 29 } 30 31 enum E1 { e10 = INT_MAX, e11 }; /* { dg-error "overflow in enumeration values" } */ 32 enum E2 { e20 = (unsigned) INT_MAX, e21 }; /* { dg-error "overflow in enumeration values" } */ 33