This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/50810] c++0x-compat does not warn about narrowing conversions
- From: "paolo.carlini at oracle dot com" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: Fri, 21 Oct 2011 22:50:00 +0000
- Subject: [Bug c++/50810] c++0x-compat does not warn about narrowing conversions
- Auto-submitted: auto-generated
- References: <bug-50810-4@http.gcc.gnu.org/bugzilla/>
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?