aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.dg/c23-enum-5.c
blob: f39b1d24441856ee5bffb4cad720ab627493c934 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
/* Test C23 enumerations with values not representable in int.  Test
   -Wc11-c23-compat warnings.  */
/* { dg-do compile } */
/* { dg-options "-std=c23 -pedantic-errors -Wc11-c23-compat" } */

enum e1 { e1a = -__LONG_LONG_MAX__ - 1 }; /* { dg-warning "ISO C restricts enumerator values" } */

enum e2 { e2a = __LONG_LONG_MAX__ }; /* { dg-warning "ISO C restricts enumerator values" } */

enum e3 { e3a = (unsigned int) -1 }; /* { dg-warning "ISO C restricts enumerator values" } */

enum e4 { e4a = (long long) -__INT_MAX__ - 1, e4b = (unsigned int) __INT_MAX__ };