================
@@ -857,8 +881,13 @@ void CXXRecordDecl::addedMember(Decl *D) {
         data().HasDeclaredCopyAssignmentWithConstParam = true;
     }
 
-    if (Method->isMoveAssignmentOperator())
+    if (Method->isMoveAssignmentOperator()) {
       SMKind |= SMF_MoveAssignment;
+    }
+
+    if (Method->isUserProvided() &&
+        (Method->isCopyAssignment() || Method->isMoveAssignment()))
+      data().IsNaturallyTriviallyRelocatable = false;
----------------
dangelog wrote:

I've also been asked to comment. My personal opinion is that relocability is 
strictly tied to the Rule Of Five. The moment a user decides to opt into the 
RO5 by e.g. writing a custom assignment operator, they should lose trivial 
relocability, unless they do something extra to gain it back (different 
proposals disagree on the syntax but ultimately they achieve the same). (We may 
then argue regarding all the subtleties about user-declared vs. user-defaulted 
vs. user-defined, but I don't really have a strong opinion about that.)

https://github.com/llvm/llvm-project/pull/84621
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to