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: unassig...@gcc.gnu.org ReportedBy: r...@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.)