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

Shafik Yaghmour via cfe-commits cfe-commits at lists.llvm.org
Fri Oct 27 21:59:36 PDT 2023


================
@@ -11773,7 +11786,25 @@ QualType Sema::CheckShiftOperands(ExprResult &LHS, ExprResult &RHS,
       isScopedEnumerationType(RHSType)) {
     return InvalidOperands(Loc, LHS, RHS);
   }
-  DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType);
+
+  BadShiftValueKind BSVKind =
+      DiagnoseBadShiftValues(*this, LHS, RHS, Loc, Opc, LHSType);
+  if (ExprEvalContexts.back().isConstantEvaluated()) {
----------------
shafik wrote:

This feels pretty hacky but perhaps I am not fully understanding the solution.

Can you update the description with more details on why this is a good approach to the problem.

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


More information about the cfe-commits mailing list