[clang] [clang][CodeGen] Fix MSVC ABI for classes with a deleted copy assignment operator (PR #90547)

Eli Friedman via cfe-commits cfe-commits at lists.llvm.org
Fri May 3 12:29:38 PDT 2024


================
@@ -1131,13 +1132,18 @@ static bool isTrivialForMSVC(const CXXRecordDecl *RD, QualType Ty,
     return false;
   if (RD->hasNonTrivialCopyAssignment())
     return false;
+  if (RD->needsImplicitCopyAssignment() && !RD->hasSimpleCopyAssignment())
----------------
efriedma-quic wrote:

If I'm understanding correctly, this is basically split into two parts:

- If we implicitly declared the copy-assignment, just query isDeleted() on it directly.
- If we didn't implicitly declare the copy-assignment, check whether it would have been deleted.  (We can't use this in cases where the copy-assignment was declared because the information isn't stored in the CXXRecordDecl.)

This is kind of complicated, but I can't think of a simpler way to do it.  That said, it probably deserves a comment to explain the logic.

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


More information about the cfe-commits mailing list