From dc28f9d087324f77db81e7192648a17ebf036125 Mon Sep 17 00:00:00 2001 From: Timm Baeder Date: Thu, 8 May 2025 05:22:11 +0200 Subject: [clang][ExprConstant] Bail out on invalid lambda capture inits (#138832) Fixes https://github.com/llvm/llvm-project/issues/138824 --- clang/lib/AST/ByteCode/Compiler.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) (limited to 'clang/lib/AST/ByteCode/Compiler.cpp') diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp index ae6574c..3cc55c7 100644 --- a/clang/lib/AST/ByteCode/Compiler.cpp +++ b/clang/lib/AST/ByteCode/Compiler.cpp @@ -2932,10 +2932,9 @@ bool Compiler::VisitLambdaExpr(const LambdaExpr *E) { // record with their initializers. for (const Record::Field &F : R->fields()) { const Expr *Init = *CaptureInitIt; - ++CaptureInitIt; - - if (!Init) + if (!Init || Init->containsErrors()) continue; + ++CaptureInitIt; if (std::optional T = classify(Init)) { if (!this->visit(Init)) -- cgit v1.1