diff options
author | Chris Lattner <sabre@nondot.org> | 2007-08-28 06:15:15 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2007-08-28 06:15:15 +0000 |
commit | ac60968d4541aa4e80fa71f64c36adfe5aa586e4 (patch) | |
tree | 544f2255c32b2d6b499825a13736695466b86283 /test/Sema/enum.c | |
parent | 050785860b8541c837982beef3f06d292d1d0c1d (diff) |
compute the required destination type for an enum, emitting various warnings.
TODO: update the types of the constants and the enum.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41532 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Sema/enum.c')
-rw-r--r-- | test/Sema/enum.c | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/test/Sema/enum.c b/test/Sema/enum.c new file mode 100644 index 0000000000..1ba3977a78 --- /dev/null +++ b/test/Sema/enum.c @@ -0,0 +1,24 @@ +// RUN: clang %s -parse-ast-check -pedantic + +enum e {A, + B = 42LL << 32, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} + C = -4, D = 12456 }; + +enum f { a = -2147483648, b = 2147483647 }; // ok. + +enum g { // too negative + c = -2147483649, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} + d = 2147483647 }; +enum h { e = -2147483648, // too pos + f = 2147483648 // expected-warning {{ISO C restricts enumerator values to range of 'int'}} +}; + +// minll maxull +enum x // expected-warning {{enumeration values exceed range of largest integer}} +{ y = -9223372036854775807LL-1, // expected-warning {{ISO C restricts enumerator values to range of 'int'}} +z = 9223372036854775808ULL }; // expected-warning {{ISO C restricts enumerator values to range of 'int'}} + +int test() { + return sizeof(enum e) ; +} + |