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

Sebastian Redl sebastian.redl at getdesigned.at
Wed Jul 29 02:57:39 PDT 2015



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



More information about the cfe-commits mailing list