[clang] [clang][Sema] Track trivial-relocatability as a type trait (PR #84621)

Krystian Stasiowski via cfe-commits cfe-commits at lists.llvm.org
Fri Mar 15 08:20:43 PDT 2024


================
@@ -826,6 +842,14 @@ void CXXRecordDecl::addedMember(Decl *D) {
               ? !Constructor->isImplicit()
               : (Constructor->isUserProvided() || Constructor->isExplicit()))
         data().Aggregate = false;
+
+      // A trivially relocatable class is a class:
+      // -- where no eligible copy constructor, move constructor, copy
+      // assignment operator, move assignment operator, or destructor is
+      // user-provided,
+      if (Constructor->isUserProvided() && (Constructor->isCopyConstructor() ||
----------------
sdkrystian wrote:

This does not appear to do what the comment says -- `IsNaturallyTriviallyRelocatable` is cleared even when the constructor is ineligible. Maybe this should be moved to `addedEligibleSpecialMemberFunction`?

https://github.com/llvm/llvm-project/pull/84621


More information about the cfe-commits mailing list