[clang] [clang] Emit bad shift warnings (PR #70307)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Mar 25 08:48:14 PDT 2024
================
@@ -19959,7 +19961,10 @@ bool Sema::DiagRuntimeBehavior(SourceLocation Loc, ArrayRef<const Stmt*> Stmts,
case ExpressionEvaluationContext::ConstantEvaluated:
case ExpressionEvaluationContext::ImmediateFunctionContext:
// Relevant diagnostics should be produced by constant evaluation.
- break;
+
+ // Solution below works for warnings detected in
+ // Sema::DiagnoseBadShiftValues()
+ return DiagIfReachable(Loc, Stmts, PD);
----------------
AaronBallman wrote:
This seems incorrect to me -- `DiagRuntimeBehavior()` is used to diagnose runtime issues, so we should not be emitting diagnostics for constant evaluations.
https://github.com/llvm/llvm-project/pull/70307
More information about the cfe-commits
mailing list