On Wed, Jul 29, 2015 at 2:57 AM, Sebastian Redl <
[email protected]> 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.
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits

Reply via email to