================
@@ -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;
----------------
brevzin wrote:

> Only "stupid types" will have a trivial copy/move constructor and a 
> non-trivial assignment operator that does something different.

One such type is `std::tuple<int&>`. As far as I can tell, the way the 
different papers handle this type is:

* P1144: not trivially relocatable (because the copy/move assignment operator 
is user-provided)
* P2786: trivially relocatable (because we only care about move construction, 
and that one is defaulted)

I don't actually know what goes wrong (if anything) if you make `tuple<int&>` 
trivially relocatable, but at least that's a nice concrete example to think 
about. 

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