[cfe-dev] [cfe-commits] r169670 - in /cfe/trunk: include/clang/AST/DeclCXX.h lib/AST/DeclCXX.cpp lib/Sema/SemaDeclCXX.cpp

Richard Smith richard at metafoo.co.uk
Mon Dec 10 16:17:56 PST 2012


On Mon, Dec 10, 2012 at 12:35 AM, Kim Gräsman <kim.grasman at gmail.com> wrote:
> Hi Richard,
>
> On Mon, Dec 10, 2012 at 6:39 AM, Richard Smith <richard at metafoo.co.uk> wrote:
>> On Sun, Dec 9, 2012 at 2:12 PM, Kim Gräsman <kim.grasman at gmail.com> wrote:
>>> On Sun, Dec 9, 2012 at 11:11 PM, Kim Gräsman <kim.grasman at gmail.com> wrote:
>>>>
>>>> I think that's equivalent to our previous;
>>>>
>>>>     if (hasImplicitDeclaredCopyAssignment) {
>>>>       something(decl->getCopyAssignmentOperator(true));
>>>>       something(decl->getCopyAssignmentOperator(false));
>>>>     }
>>>
>>> ... oh, except it also handles move assignment operators, which is nice.
>>
>> It also only calls 'something' on the implicit copy assignment operator once :)
>
> The new one, you mean?
>
> I think the old one (above) called 'something' for;
>
>  T& operator=(const T& t);
>  T& operator=(T& t);
>
> whereas the new one should call it for any of the below that exist:
>
>  T& operator=(const T& t);
>  T& operator=(const volatile T& t);
>  T& operator=(T& t);
>  T& operator=(volatile T& t);
>  T& operator=(T&& t);
>
> I think that preserves the behavior we had and makes it more correct,
> even if I'm not entirely sure why this is done. :-/

There can only be one implicit copy assignment operator, and if there
is an implicit one, there are no explicit ones. The former code would
call 'something' twice, passing the same function both times...




More information about the cfe-dev mailing list