https://gcc.gnu.org/bugzilla/show_bug.cgi?id=64141
Bug ID: 64141
Summary: Add option, -Wextra-copy
Product: gcc
Version: unknown
Status: UNCONFIRMED
Severity: enhancement
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: r.p.nicholl at gmail dot com
I am suggesting to add -Wextra-copy. When you copy from a value in local scope
which is not accessed again afterwards, then this warning is triggered.
So for example:
extern std::string bar();
extern void foo(std::string);
int main()
{
std::string s = bar();
foo(s);
return 0;
}
This would cause a warning at the call to foo(s), because it could be replaced
with a move-call in most cases.