http://gcc.gnu.org/bugzilla/show_bug.cgi?id=54388
--- Comment #13 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-09-09
17:56:15 UTC ---
(In reply to comment #10)
> Can the compiler warn about the original (buggy) code?
It already does:
c.cc: In function ‘A& get(int)’:
c.cc:3:43: error: invalid initialization of non-const reference of type ‘A&’
from an rvalue of type ‘A’
A& get(int i) { return i == 0 ? a : throw 1; }
^
But warnings are suppressed in system headers.
