[clang] [clang][AST] Fix crash on labeled break/continue within switch condition statement expression (PR #228655)

via cfe-commits cfe-commits at lists.llvm.org
Sat Oct 10 10:06:14 PDT 2026


================
@@ -7196,6 +7196,9 @@ bool Compiler<Emitter>::visitBreakStmt(const BreakStmt *S) {
       }
     }
   } else {
+    const Stmt *TargetLoop = S->getNamedLoopOrSwitch();
+    assert(TargetLoop && "break target label not available");
----------------
Expertcoderz wrote:

Okay now it should error on encountering invalid labeled `break`/`continue` within otherwise valid loops in constant expressions, whether or not the new interpreter is being used.

Now all that's left (I think?) is to make the error message a bit clearer.

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


More information about the cfe-commits mailing list