[cfe-commits] r133593 - /cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Sean Hunt
scshunt at csclub.uwaterloo.ca
Tue Jun 21 18:05:13 PDT 2011
Author: coppro
Date: Tue Jun 21 20:05:13 2011
New Revision: 133593
URL: http://llvm.org/viewvc/llvm-project?rev=133593&view=rev
Log:
Ensure that we delete implict copy members when explicit move members
are also present.
Modified:
cfe/trunk/lib/Sema/SemaDeclCXX.cpp
Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=133593&r1=133592&r2=133593&view=diff
==============================================================================
--- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
+++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Tue Jun 21 20:05:13 2011
@@ -6771,7 +6771,13 @@
PushOnScopeChains(CopyAssignment, S, false);
ClassDecl->addDecl(CopyAssignment);
- if (ShouldDeleteCopyAssignmentOperator(CopyAssignment))
+ // C++0x [class.copy]p18:
+ // ... If the class definition declares a move constructor or move
+ // assignment operator, the implicitly declared copy assignment operator is
+ // defined as deleted; ...
+ if (ClassDecl->hasUserDeclaredMoveConstructor() ||
+ ClassDecl->hasUserDeclaredMoveAssignment() ||
+ ShouldDeleteCopyAssignmentOperator(CopyAssignment))
CopyAssignment->setDeletedAsWritten();
AddOverriddenMethods(ClassDecl, CopyAssignment);
@@ -7233,7 +7239,13 @@
PushOnScopeChains(CopyConstructor, S, false);
ClassDecl->addDecl(CopyConstructor);
- if (ShouldDeleteCopyConstructor(CopyConstructor))
+ // C++0x [class.copy]p7:
+ // ... If the class definition declares a move constructor or move
+ // assignment operator, the implicitly declared constructor is defined as
+ // deleted; ...
+ if (ClassDecl->hasUserDeclaredMoveConstructor() ||
+ ClassDecl->hasUserDeclaredMoveAssignment() ||
+ ShouldDeleteCopyConstructor(CopyConstructor))
CopyConstructor->setDeletedAsWritten();
return CopyConstructor;
More information about the cfe-commits
mailing list