aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Interp.cpp
diff options
context:
space:
mode:
authorTimm Baeder <tbaeder@redhat.com>2025-05-23 08:17:22 +0200
committerGitHub <noreply@github.com>2025-05-23 08:17:22 +0200
commit32805964fcc2d5ad6296aae91e18053720e7a8a0 (patch)
treeaae700b9cdc31baf8d6c7fd97253d616812edabd /clang/lib/AST/ByteCode/Interp.cpp
parent02ed6d82f66f79b0f546c3af37252d6753228451 (diff)
downloadllvm-32805964fcc2d5ad6296aae91e18053720e7a8a0.zip
llvm-32805964fcc2d5ad6296aae91e18053720e7a8a0.tar.gz
llvm-32805964fcc2d5ad6296aae91e18053720e7a8a0.tar.bz2
[clang][bytecode] Diagnose placement-new'ing to a temporary (#141099)
... that's been created in a different evaluation.
Diffstat (limited to 'clang/lib/AST/ByteCode/Interp.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Interp.cpp2
1 files changed, 2 insertions, 0 deletions
diff --git a/clang/lib/AST/ByteCode/Interp.cpp b/clang/lib/AST/ByteCode/Interp.cpp
index 7cc0d2a..1766057 100644
--- a/clang/lib/AST/ByteCode/Interp.cpp
+++ b/clang/lib/AST/ByteCode/Interp.cpp
@@ -1703,6 +1703,8 @@ bool CheckNewTypeMismatch(InterpState &S, CodePtr OpPC, const Expr *E,
std::optional<uint64_t> ArraySize) {
const Pointer &Ptr = S.Stk.peek<Pointer>();
+ if (!CheckTemporary(S, OpPC, Ptr, AK_Construct))
+ return false;
if (!CheckStore(S, OpPC, Ptr))
return false;