[clang] [clang] Emit bad shift warnings (PR #70307)

Budimir Aranđelović via cfe-commits cfe-commits at lists.llvm.org
Wed Mar 20 08:41:37 PDT 2024


================
@@ -2836,9 +2837,11 @@ static bool handleIntIntBinOp(EvalInfo &Info, const Expr *E, const APSInt &LHS,
     // C++11 [expr.shift]p1: Shift width must be less than the bit width of the
     // shifted type.
     unsigned SA = (unsigned) RHS.getLimitedValue(LHS.getBitWidth()-1);
-    if (SA != RHS)
+    if (SA != RHS && Info.getLangOpts().CPlusPlus11) {
----------------
budimirarandjelovicsyrmia wrote:

Same

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


More information about the cfe-commits mailing list