[clang][bytecode] Variadic ctors also start lifetime#201113
Merged
Merged
Conversation
This is the same thing we do in the non-variadic `Call()`.
|
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) ChangesThis is the same thing we do in the non-variadic Full diff: https://github.com/llvm/llvm-project/pull/201113.diff 2 Files Affected:
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 6bcebf3ee892b..0ea6de1742175 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1747,7 +1747,8 @@ 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;
+}
|
yingopq
pushed a commit
to yingopq/llvm-project
that referenced
this pull request
Jun 5, 2026
This is the same thing we do in the non-variadic `Call()`.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is the same thing we do in the non-variadic
Call().