r243463 - Do not give a -Wredundant-move warning when removing the move will result in an

Richard Trieu rtrieu at google.com
Wed Jul 29 11:29:27 PDT 2015


On Wed, Jul 29, 2015 at 2:57 AM, Sebastian Redl <
sebastian.redl at getdesigned.at> wrote:

>
>
> On 28.07.2015 21:06, Richard Trieu wrote:
>
>> Author: rtrieu
>> Date: Tue Jul 28 14:06:16 2015
>> New Revision: 243463
>>
>> URL: http://llvm.org/viewvc/llvm-project?rev=243463&view=rev
>> Log:
>> Do not give a -Wredundant-move warning when removing the move will result
>> in an
>> error.
>>
>> If the object being moved has a move constructor and a deleted copy
>> constructor,
>> std::move is required, otherwise Clang will give a deleted constructor
>> error.
>>
>>  Is that actually correct behavior by Clang? GCC 5.2 compiles the
> following without problems:
>
> struct A {
>     A() {}
>     A(A&&) {}
> };
>
> struct B {
>   B(A) {}
> };
>
> B fn(A a) {
>     return a;
> }
>
> int main() {
>     fn(A());
> }
>
> Sebastian
>
> I believe that older versions of GCC will give an error on this code as
well.  In discussions with Richard Smith, he mentioned that there is a DR
for this and that Clang should implement it.  Until it is implemented, this
warning should not suggest a fix that won't compile.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20150729/49466187/attachment.html>


More information about the cfe-commits mailing list