[PATCH] D16376: clang-tidy check: User-defined copy without assignment

Jonathan B Coe via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 22 06:26:29 PST 2016


jbcoe added inline comments.

================
Comment at: clang-tidy/misc/UserDefinedCopyWithoutAssignmentCheck.h:25
@@ +24,3 @@
+/// assignment operator to be `= delete`.
+///
+/// For the user-facing documentation see:
----------------
jbcoe wrote:
> The standard says that compiler generation of the assignment operator is deprecated if there is a user-defined copy constructor 12.8.18 . 
> 
> '= default' still counts as user-defined to the best of my understanding.
> 
> MSVC, clang and gcc all generate assignment operators in the face of deleted copy constructors. None of them seem to follow the deprecation rule.
> 
> I agree entirely with your point in principle, but it seems to be at odds with the standard. I think requiring the user to explicitly default the assignment operator by generating a deleted assignment operator is the right thing to do.
On reflection this is pedantic. As you say if a user defaults one, they will want to default the other. 


http://reviews.llvm.org/D16376





More information about the cfe-commits mailing list