[clang] [clang][Sema] Fix for enums overflowing (#24667) (PR #78742)

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Feb 23 15:47:56 PST 2024


================
@@ -18,6 +19,40 @@ enum x                      // expected-warning {{enumeration values exceed rang
 { 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'}}
 
+
+enum GH24667 {   GH24667_x = 9223372036854775807UL, };
+// expected-warning at -1 {{ISO C restricts enumerator values to range of 'int' (9223372036854775807 is too large)}}
+
+#else
+enum e {A,
+        B = 42LL << 32,
+      C = -4, D = 12456 };
+
+enum g {  // too negative
----------------
shafik wrote:

What does this comment mean? There is no diagnostic here? This also applies to the `too pos` comment below.

https://github.com/llvm/llvm-project/pull/78742


More information about the cfe-commits mailing list