This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar
- From: "redi at gcc dot gnu.org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Mon, 15 Oct 2012 07:49:04 +0000
- Subject: [Bug c++/54930] New: Add warning switch for "returning reference to temporary" and similar
- Auto-submitted: auto-generated
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54930
Bug #: 54930
Summary: Add warning switch for "returning reference to
temporary" and similar
Classification: Unclassified
Product: gcc
Version: 4.6.4
Status: UNCONFIRMED
Keywords: diagnostic
Severity: enhancement
Priority: P3
Component: c++
AssignedTo: unassigned@gcc.gnu.org
ReportedBy: redi@gcc.gnu.org
The various warnings issued by maybe_warn_about_returning_address_of_local()
are enabled by default, so there is no way to make them (and only them) into
errors.
If they were controlled by a switch such as -Wreturn-local-addr (enabled by
default) then they could be promoted to an error with -Werror=return-local-addr
(or disabled with -Wno-return-local-addr for the foolish.)