modula2: M2MetaError.{def,mod} and P2SymBuild.mod further cleanup
[official-gcc.git] / gcc / testsuite / gcc.dg / c23-enum-3.c
blob191001dc281ee454032a2deae4edc7fe8e03e0e1
1 /* Test C23 enumerations with values not representable in int. Test values
2 outside the range of standard or extended integer types are diagnosed,
3 when __int128 is unsupported. */
4 /* { dg-do compile { target { ! int128 } } } */
5 /* { dg-options "-std=c23 -pedantic-errors" } */
7 enum e1 { e1a = __LONG_LONG_MAX__, e1b }; /* { dg-error "overflow in enumeration values" } */
9 enum e2 { e2a = __LONG_LONG_MAX__ * 2ULL + 1ULL, e2b }; /* { dg-error "overflow in enumeration values" } */
11 /* Likewise, when it's the enum as a whole that can't fit in any standard or
12 extended type, but the individual enumerators fit (some fitting a signed
13 type and some fitting an unsigned type). */
14 enum e3 { e3a = -__LONG_LONG_MAX__ - 1, e3b = __LONG_LONG_MAX__ * 2ULL + 1ULL }; /* { dg-error "enumeration values exceed range of largest integer" } */