http://gcc.gnu.org/bugzilla/show_bug.cgi?id=55783
Jonathan Wakely <redi at gcc dot gnu.org> changed:
What |Removed |Added
----------------------------------------------------------------------------
Severity|major |normal
--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> 2012-12-22
00:26:10 UTC ---
The standard only requires that "a conforming implementation shall issue at
least one diagnostic message" so compiling the program with a warning is
allowed. As Andrew said, -Werror=narrowing allows you to make it an error if
you want.
G++ 4.6 gave an error but it was changed to a warning intentionally for 4.7
because many people (myself included) found that narrowing conversions where
one of the most commonly encountered problems when trying to compile large
C++03 codebases as C++11. Previously well-formed code such as char c[] = { i,
0 }; (where i will only ever be within the range of char) caused errors and had
to be changed to char c[] = { (char)i, 0 }