[clang] [Sema] Instantiate destructors for initialized anonymous union fields (PR #128866)
Maurice Heumann via cfe-commits
cfe-commits at lists.llvm.org
Wed Mar 5 02:43:37 PST 2025
================
@@ -5863,6 +5869,26 @@ Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
&DirectVirtualBases);
}
+void Sema::MarkBaseAndMemberDestructorsReferenced(SourceLocation Location,
+ CXXRecordDecl *ClassDecl) {
+ // Ignore dependent contexts. Also ignore unions, since their members never
+ // have destructors implicitly called.
+ if (ClassDecl->isDependentContext() || ClassDecl->isUnion())
+ return;
+
+ // FIXME: all the access-control diagnostics are positioned on the
+ // field/base declaration. That's probably good; that said, the
+ // user might reasonably want to know why the destructor is being
+ // emitted, and we currently don't say.
----------------
momo5502 wrote:
Hard for me to judge. It was added 15 years ago: https://github.com/llvm/llvm-project/commit/1064d7ef2992225ddbd792d1b54d144b809b5b39
I can remove it, if desired.
https://github.com/llvm/llvm-project/pull/128866
More information about the cfe-commits
mailing list