-
Notifications
You must be signed in to change notification settings - Fork 11.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[clang][bytecode] Ignore explicit calls to trivial dtors #112841
Conversation
This is what the current interpreter does as well.
@llvm/pr-subscribers-clang Author: Timm Baeder (tbaederr) ChangesThis is what the current interpreter does as well. Full diff: https://github.com/llvm/llvm-project/pull/112841.diff 2 Files Affected:
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 8ca63bf64aa0ef..a71c0dcc9381e8 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -4535,6 +4535,10 @@ bool Compiler<Emitter>::VisitCallExpr(const CallExpr *E) {
return VisitBuiltinCallExpr(E, Builtin::BI__builtin_operator_delete);
}
}
+ // Explicit calls to trivial destructors
+ if (const auto *DD = dyn_cast_if_present<CXXDestructorDecl>(FuncDecl);
+ DD && DD->isTrivial())
+ return true;
QualType ReturnType = E->getCallReturnType(Ctx.getASTContext());
std::optional<PrimType> T = classify(ReturnType);
diff --git a/clang/test/AST/ByteCode/placement-new.cpp b/clang/test/AST/ByteCode/placement-new.cpp
index 8e6d802e93295c..5673b5cba3f700 100644
--- a/clang/test/AST/ByteCode/placement-new.cpp
+++ b/clang/test/AST/ByteCode/placement-new.cpp
@@ -311,3 +311,16 @@ constexpr bool change_union_member() {
return u.b == 2;
}
static_assert(change_union_member());
+
+namespace PR48606 {
+ struct A { mutable int n = 0; };
+
+ constexpr bool f() {
+ A a;
+ A *p = &a;
+ p->~A();
+ std::construct_at<A>(p);
+ return true;
+ }
+ static_assert(f());
+}
|
LLVM Buildbot has detected a new failure on builder Full details are available at: https://lab.llvm.org/buildbot/#/builders/133/builds/5383 Here is the relevant piece of the build log for the reference
|
This is what the current interpreter does as well.