This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/87882] New: -Wredundant-move false positive


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();
> }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]