Add new test to verify that the array index, limit, and stride are
[official-gcc.git] / gcc / testsuite / gcc.dg / pr30260.c
blobf7373176ed5150524706fddf1f12453d422fb36b
1 /* PR 30260 */
2 /* { dg-do link } */
3 /* { dg-options "-pedantic -O" } */
4 #include <limits.h>
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'" } */
14 int main(void)
16 enum A a = -1;
17 enum B b = -1;
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 ();
28 return 0;
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" } */