https://github.com/tbaederr created 
https://github.com/llvm/llvm-project/pull/147533

Not attaching a test since I've only seen this when compiling a large c++26 
test case as c++17.

>From fe3d8b287ddeff8730ee3c235aaa7f237703faaf Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com>
Date: Tue, 8 Jul 2025 16:05:57 +0200
Subject: [PATCH] [clang][bytecode] Don't crash on erroneous switch conditions

Not attaching a test since I've only seen this when compiling a large
c++26 test case as c++17.
---
 clang/lib/AST/ByteCode/Compiler.cpp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/clang/lib/AST/ByteCode/Compiler.cpp 
b/clang/lib/AST/ByteCode/Compiler.cpp
index 51c234d0d0471..ee9c3890794af 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5629,6 +5629,9 @@ bool Compiler<Emitter>::visitContinueStmt(const 
ContinueStmt *S) {
 template <class Emitter>
 bool Compiler<Emitter>::visitSwitchStmt(const SwitchStmt *S) {
   const Expr *Cond = S->getCond();
+  if (Cond->containsErrors())
+    return false;
+
   PrimType CondT = this->classifyPrim(Cond->getType());
   LocalScope<Emitter> LS(this);
 

_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to