https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96501

            Bug ID: 96501
           Summary: [C++11] Should warn when classes only have copy
                    constructor defined
           Product: gcc
           Version: 11.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
          Assignee: unassigned at gcc dot gnu.org
          Reporter: nunoplopes at sapo dot pt
  Target Milestone: ---

I see a lot of old code that has copy constructors defined, but not move
constructors. This pessimizes code since the definition of the copy constructor
hides the default move constructor.
Would be nice to get a warning for this to recover perf.

```
#include <utility>
using namespace std;

struct foo {
  int a,b,c;
  // expect-warning
  foo(const foo &);
};

foo fn(foo &&f) {
  foo g(move(f));
  return g;
}
```

https://gcc.godbolt.org/z/5r8erG

Reply via email to