http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48087
--- Comment #12 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2011-10-19 01:44:12 UTC --- I think the problem is the seen_error() test in gimple_push_cleanup. I am guessing that it does some kind of "folding" that is skipped when an error has been issued. There are two issues here: 1) Warnings converted to errors are not real errors, that is, the program is still valid and we could in principle do whatever stuff we would do for a valid program. We could do s/seen_error/seen_any_error/, and then add seen_real_error (program_is_invalid). I bet most of the cases using seen_any_error, actually mean program_is_invalid. 2) Whether even with real errors, we can fix the gimple generated by C++ to not trigger the Wreturn-type warning. Or alternatively, make Wreturn-type more intelligent to not emit a bogus warning here. The point here is that it is perhaps possible to generate such a gimple from C++ that causes a bogus warning. Currently, gimplify_push_cleanup "fixes" the bad gimple to avoid the warning, but perhaps in other testcases, this "fix" doesn't trigger and we get a bogus warning. The thing is that even if we fix 1, we could probably trigger a real error earlier and we end up with 2 (no inconsistency, but still bogus warning).