https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/152857
This is the correct function to use and it will create a variable scope. Fixes #152822 >From ae8274304760e2a4326cbb20edf96f0865d3da98 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <tbae...@redhat.com> Date: Sat, 9 Aug 2025 15:38:40 +0200 Subject: [PATCH] [clang][bytecode] Use visitExpr() in interpretCall This is the correct function to use and it will create a variable scope. Fixes #152822 --- clang/lib/AST/ByteCode/EvalEmitter.cpp | 2 +- clang/test/AST/ByteCode/functions.cpp | 5 +++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ByteCode/EvalEmitter.cpp b/clang/lib/AST/ByteCode/EvalEmitter.cpp index 9ed61c7b0be78..ecd42012987d4 100644 --- a/clang/lib/AST/ByteCode/EvalEmitter.cpp +++ b/clang/lib/AST/ByteCode/EvalEmitter.cpp @@ -98,7 +98,7 @@ bool EvalEmitter::interpretCall(const FunctionDecl *FD, const Expr *E) { this->Params.insert({PD, {0, false}}); } - if (!this->visit(E)) + if (!this->visitExpr(E, /*DestroyToplevelScope=*/true)) return false; PrimType T = Ctx.classify(E).value_or(PT_Ptr); return this->emitPop(T, E); diff --git a/clang/test/AST/ByteCode/functions.cpp b/clang/test/AST/ByteCode/functions.cpp index 36e7bb32b2d86..0a38122df4fc8 100644 --- a/clang/test/AST/ByteCode/functions.cpp +++ b/clang/test/AST/ByteCode/functions.cpp @@ -708,3 +708,8 @@ namespace NoDiags { return true; } } + +namespace EnableIfWithTemporary { + struct A { ~A(); }; + int &h() __attribute__((enable_if((A(), true), ""))); +} _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits