This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/87882] New: -Wredundant-move false positive
- From: "its at cleroth dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 05 Nov 2018 14:19:42 +0000
- Subject: [Bug c++/87882] New: -Wredundant-move false positive
- Auto-submitted: auto-generated
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=87882
Bug ID: 87882
Summary: -Wredundant-move false positive
Product: gcc
Version: 9.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: its at cleroth dot com
Target Milestone: ---
Warning suggests to remove `std::move` on `Foo::Bar()` despite it producing
different code:
> #include <string>
> struct Foo {
> Foo Bar() {
> return std::move(*this);
> }
> Foo Baz() {
> return *this;
> }
> std::string s;
> };
> void Move(Foo & f)
> {
> f = Foo{}.Bar();
> }
> void NoMove(Foo & f)
> {
> f = Foo{}.Baz();
> }