https://github.com/tbaederr created https://github.com/llvm/llvm-project/pull/201113
This is the same thing we do in the non-variadic `Call()`. >From cc06e62076024ae518f9e1d71849884af46f5874 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timm=20B=C3=A4der?= <[email protected]> Date: Tue, 2 Jun 2026 15:09:22 +0200 Subject: [PATCH] [clang][bytecode] Variadic ctors also start lifetime This is the same thing we do in the non-variadic `Call()`. --- clang/lib/AST/ByteCode/Interp.cpp | 4 +++- clang/test/AST/ByteCode/records.cpp | 13 +++++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp index 6bcebf3ee892b..ea2a46918b8a5 100644 --- a/clang/lib/AST/ByteCode/Interp.cpp +++ b/clang/lib/AST/ByteCode/Interp.cpp @@ -1747,7 +1747,9 @@ bool CallVar(InterpState &S, CodePtr OpPC, const Function *Func, if (!(S.Current->getFunction() && S.Current->getFunction()->isLambdaStaticInvoker() && Func->isLambdaCallOperator())) { - if (!CheckInvoke(S, OpPC, ThisPtr)) + if (!CheckInvoke(S, OpPC, ThisPtr, + Func->isConstructor() || Func->isDestructor())) + return false; } diff --git a/clang/test/AST/ByteCode/records.cpp b/clang/test/AST/ByteCode/records.cpp index a9b8ac6b10bcb..b792b56563b2f 100644 --- a/clang/test/AST/ByteCode/records.cpp +++ b/clang/test/AST/ByteCode/records.cpp @@ -2031,3 +2031,16 @@ namespace StaticMemberRedecl { const int S::m = 10; static_assert(getM() == 10, ""); } + +namespace VariadicCtorStartsLifetime { + struct S { + constexpr S(int, ...) {} + }; + class C { + public: + S s; + constexpr C() : s(1,1) {} + }; + /// Used to not start the lifetime of 's'. + constexpr C c; +} _______________________________________________ cfe-commits mailing list [email protected] https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits
