[Bug c++/50810] c++0x-compat does not warn about narrowing conversions
paolo.carlini at oracle dot com
gcc-bugzilla@gcc.gnu.org
Fri Oct 21 22:50:00 GMT 2011
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=50810
Paolo Carlini <paolo.carlini at oracle dot com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |jason at gcc dot gnu.org,
| |paolo.carlini at oracle dot
| |com, redi at gcc dot
| |gnu.org
--- Comment #2 from Paolo Carlini <paolo.carlini at oracle dot com> 2011-10-21 22:50:00 UTC ---
Note, this changed between 4.6 and 4.7 from permerror to pedwarn.
This said, check_narrowing is called by digest_init_r like this:
if (cxx_dialect != cxx98 && nested)
check_narrowing (type, init);
thus probably it would be easy to call it also when cxx_dialect is cxx98 &&
warn_cxx0x_compat and then, at the end, have something like:
if (!ok)
{
if (cxx_dialect != cxx98)
pedwarn (input_location, OPT_Wnarrowing, "narrowing conversion of %qE "
"from %qT to %qT inside { }", init, ftype, type);
else
warning (OPT_Wc__0x_compat, "narrowing conversion of %qE "
"from %qT to %qT inside { }", init, ftype, type);
}
maybe with a slightly different message in the -Wc++0x-compat case.
Jason?
More information about the Gcc-bugs
mailing list