Chris Lattner | ac60968 | 2007-08-28 06:15:15 +0000 | [diff] [blame^] | 1 | // RUN: clang %s -parse-ast-check -pedantic |
| 2 | |
| 3 | enum e {A, |
| 4 | B = 42LL << 32, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} |
| 5 | C = -4, D = 12456 }; |
| 6 | |
| 7 | enum f { a = -2147483648, b = 2147483647 }; // ok. |
| 8 | |
| 9 | enum g { // too negative |
| 10 | c = -2147483649, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} |
| 11 | d = 2147483647 }; |
| 12 | enum h { e = -2147483648, // too pos |
| 13 | f = 2147483648 // expected-warning {{ISO C restricts enumerator values to range of 'int'}} |
| 14 | }; |
| 15 | |
| 16 | // minll maxull |
| 17 | enum x // expected-warning {{enumeration values exceed range of largest integer}} |
| 18 | { y = -9223372036854775807LL-1, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} |
| 19 | z = 9223372036854775808ULL }; // expected-warning {{ISO C restricts enumerator values to range of 'int'}} |
| 20 | |
| 21 | int test() { |
| 22 | return sizeof(enum e) ; |
| 23 | } |
| 24 | |