http://gcc.gnu.org/bugzilla/show_bug.cgi?id=48087
--- Comment #23 from Manuel López-Ibáñez <manu at gcc dot gnu.org> 2013-01-15 16:39:22 UTC --- (In reply to comment #22) > Created attachment 29170 [details] > gcc48-pr48087.patch > > Untested fix. That said, it seems that on the provided testcase g++ already > generates the same set of warnings/errors for -Wreturn-type vs. > -Werror=return-type, starting with > http://gcc.gnu.org/viewcvs?root=gcc&view=rev&rev=186687 > so supposedly you'd need to find a different testcase for this to still claim > 4.8 Regression status. > > Not sure if this can be stage4 material, I think it is more stage1-ish > material. I think this hunk is not correct: --- gcc/cp/typeck.c.jj 2013-01-11 09:02:46.000000000 +0100 +++ gcc/cp/typeck.c 2013-01-15 15:35:47.216641020 +0100 @@ -7967,11 +7967,11 @@ convert_for_initialization (tree exp, tr int savew = 0, savee = 0; if (fndecl) - savew = warningcount, savee = errorcount; + savew = warningcount + werrorcount, savee = errorcount; rhs = initialize_reference (type, rhs, flags, complain); if (fndecl) { - if (warningcount > savew) + if (warningcount + werrorcount > savew) warning (0, "in passing argument %P of %q+D", parmnum, fndecl); else if (errorcount > savee) error ("in passing argument %P of %q+D", parmnum, fndecl); since it will print: error: something warning: in passing argument I think this should simply be an inform note like it is done in other cases (in your own patch in gcc/cp/pt.c). This hunk also seems suspicious: --- gcc/cp/call.c.jj 2013-01-11 09:02:46.000000000 +0100 +++ gcc/cp/call.c 2013-01-15 15:34:21.267155075 +0100 @@ -5709,12 +5709,12 @@ build_temp (tree expr, tree type, int fl int savew, savee; vec<tree, va_gc> *args; - savew = warningcount, savee = errorcount; + savew = warningcount + werrorcount, savee = errorcount; args = make_tree_vector_single (expr); expr = build_special_member_call (NULL_TREE, complete_ctor_identifier, &args, type, flags, complain); release_tree_vector (args); - if (warningcount > savew) + if (warningcount + werrorcount > savew) *diagnostic_kind = DK_WARNING; else if (errorcount > savee) *diagnostic_kind = DK_ERROR; I am not sure what for *diagnostic_kind is used, but it seems to change the current behaviour (since a Werror will result in *diagnostic_kind = DK_ERROR before your patch).