[clang] [clang-tools-extra] [C2y] Implement WG14 N3409 (PR #130299)

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 7 10:18:36 PST 2025


================
@@ -2269,11 +2269,10 @@ StmtResult Sema::ActOnForStmt(SourceLocation ForLoc, SourceLocation LParenLoc,
       for (auto *DI : DS->decls()) {
         if (VarDecl *VD = dyn_cast<VarDecl>(DI)) {
           VarDeclSeen = true;
-          if (VD->isLocalVarDecl() && !VD->hasLocalStorage())
-            Diag(DI->getLocation(),
-                 getLangOpts().C23
-                     ? diag::warn_c17_non_local_variable_decl_in_for
-                     : diag::ext_c23_non_local_variable_decl_in_for);
+          if (VD->isLocalVarDecl() && !VD->hasLocalStorage()) {
+            Diag(DI->getLocation(), diag::err_non_local_variable_decl_in_for);
+            DI->setInvalidDecl();
+          }
----------------
AaronBallman wrote:

yeah, I think so! I'll drop this, good catch

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


More information about the cfe-commits mailing list