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

via cfe-commits cfe-commits at lists.llvm.org
Sun Feb 25 06:52:26 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
----------------
wheatman wrote:

I have removed those comments, those were copied showing the different behavior in different modes, but those comments should only be in the pre C23 version

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


More information about the cfe-commits mailing list