On 16/08/2022 14:27, Marek Polacek via Gcc-patches wrote:
Ping.  (The other std::move patches depend on this one.)

<https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=8d22c7cb8b1a6f9b67c54a798dd5504244614e51> "c++: Extend -Wpessimizing-move to other contexts" started to cause false positive

$ cat test.cc
#include <utility>
struct S1 {
    S1();
    S1(S1 const &) = delete;
    S1(S1 &&);
    S1 operator =(S1 const &) = delete;
    S1 operator =(S1 &&);
};
struct S2 { S2(S1); };
S2 f() {
    S1 s;
    return { std::move(s) };
}

$ g++ -fsyntax-only -Wredundant-move test.cc
test.cc: In function ‘S2 f()’:
test.cc:12:27: warning: redundant move in return statement [-Wredundant-move]
   12 |     return { std::move(s) };
      |                           ^
test.cc:12:27: note: remove ‘std::move’ call

Reply via email to