[cfe-commits] r148675 - in /cfe/trunk: lib/Sema/SemaDeclCXX.cpp test/SemaCXX/microsoft-cxx0x.cpp
Eli Friedman
eli.friedman at gmail.com
Sun Jan 22 19:50:33 PST 2012
On Sun, Jan 22, 2012 at 7:19 PM, Nico Weber <nicolasweber at gmx.de> wrote:
> Author: nico
> Date: Sun Jan 22 21:19:29 2012
> New Revision: 148675
>
> URL: http://llvm.org/viewvc/llvm-project?rev=148675&view=rev
> Log:
> In ms mode, a move assignment operator shouldn't mark a copy ctor as deleted.
>
> MSVC2010's pair class has a move assignment operator but no explicit copy
> constructor, which makes it unusable without this change.
>
> For symmetry, let move copy constructors not mark the default assignment
> operator as deleted either. Both changes match cl.exe's behavior. Fixes
> pr11826.
>
> Also update the standard excerpt to point to the right paragraph.
>
>
> Modified:
> cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> cfe/trunk/test/SemaCXX/microsoft-cxx0x.cpp
>
> Modified: cfe/trunk/lib/Sema/SemaDeclCXX.cpp
> URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDeclCXX.cpp?rev=148675&r1=148674&r2=148675&view=diff
> ==============================================================================
> --- cfe/trunk/lib/Sema/SemaDeclCXX.cpp (original)
> +++ cfe/trunk/lib/Sema/SemaDeclCXX.cpp Sun Jan 22 21:19:29 2012
> @@ -7846,12 +7846,14 @@
> PushOnScopeChains(CopyAssignment, S, false);
> ClassDecl->addDecl(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() ||
> + // C++0x [class.copy]p19:
> + // .... If the class definition does not explicitly declare a copy
> + // assignment operator, there is no user-declared move constructor, and
> + // there is no user-declared move assignment operator, a copy assignment
> + // operator is implicitly declared as defaulted.
> + if ((ClassDecl->hasUserDeclaredMoveConstructor() &&
> + !getLangOptions().MicrosoftExt) ||
This should be checking for MicrosoftMode.
-Eli
More information about the cfe-commits
mailing list