[Bug c++/96452] Narrowing conversion is not rejected

redi at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue Aug 4 10:11:31 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96452

--- Comment #4 from Jonathan Wakely <redi at gcc dot gnu.org> ---
https://gcc.gnu.org/onlinedocs/gcc/C_002b_002b-Dialect-Options.html#index-Wnarrowing

For C++11 and later standards, narrowing conversions are diagnosed by default,
as required by the standard. A narrowing conversion from a constant produces an
error, and a narrowing conversion from a non-constant produces a warning, but
-Wno-narrowing suppresses the diagnostic. Note that this does not affect the
meaning of well-formed code; narrowing conversions are still considered
ill-formed in SFINAE contexts.


More information about the Gcc-bugs mailing list