[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 20:17:17 PST 2012


On Sun, Jan 22, 2012 at 8:07 PM, Nico Weber <thakis at chromium.org> wrote:
> On Sun, Jan 22, 2012 at 7:50 PM, Eli Friedman <eli.friedman at gmail.com> wrote:
>> 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.
>
> r148677, thanks.
>
> http://clang.llvm.org/docs/UsersManual.html only documents
> -fms-extensions. The only description of -fms-compatibility I could
> find is at http://llvm.org/viewvc/llvm-project?view=rev&revision=139978
> – can you think of a blurb I could put into the UsersManual to decide
> when to use which of the two switches?

-fms-extensions comes from gcc, and is basically just a few extra
language extensions.  -fms-compatibility essentially means "act as
close as possible to the way cl.exe acts"; AFAIK, it's really only
usable for source-to-source transformation and analysis tools at the
moment.

-Eli




More information about the cfe-commits mailing list