[clang] [ExprConstant] Handle shift overflow the same way as other kinds of overflow (PR #99579)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Thu Jul 18 16:47:09 PDT 2024


================
@@ -200,14 +200,7 @@ namespace LongInt {
 };
 
 enum shiftof {
-    X = (1<<-29), // all-error {{expression is not an integral constant expression}} \
-                  // all-note {{negative shift count -29}}
-
-    X2 = (-1<<29), // cxx17-error {{expression is not an integral constant expression}} \
-                   // cxx17-note {{left shift of negative value -1}} \
-                   // ref-cxx17-error {{expression is not an integral constant expression}} \
-                   // ref-cxx17-note {{left shift of negative value -1}}
-
-    X3 = (1<<32) // all-error {{expression is not an integral constant expression}} \
-                 // all-note {{shift count 32 >= width of type 'int'}}
+    X = (1<<-29),
+    X2 = (-1<<29),
+    X3 = (1<<32),
----------------
efriedma-quic wrote:

We could try messing with the behavior of VerifyIntegerConstantExpression, I guess.

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


More information about the cfe-commits mailing list