This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/64141] New: Add option, -Wextra-copy
- From: "r.p.nicholl at gmail dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 01 Dec 2014 17:52:34 +0000
- Subject: [Bug c++/64141] New: Add option, -Wextra-copy
- Auto-submitted: auto-generated
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.