[clang] [Sema] Diagnose use of if/else-if condition variable inside else-if/else branch(s) (PR #156436)
via cfe-commits
cfe-commits at lists.llvm.org
Tue Sep 23 05:35:49 PDT 2025
================
@@ -971,6 +971,35 @@ StmtResult Sema::ActOnIfStmt(SourceLocation IfLoc,
if (!ConstevalOrNegatedConsteval && !elseStmt)
DiagnoseEmptyStmtBody(RParenLoc, thenStmt, diag::warn_empty_if_body);
+ // Checks for if condition variable usage in else scope
+ if (elseStmt) {
----------------
arrowten wrote:
@erichkeane Please take look at the changes. Let me know if this can be considered.
https://github.com/llvm/llvm-project/pull/156436
More information about the cfe-commits
mailing list