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

--- Comment #6 from Jonathan Wakely <redi at gcc dot gnu.org> ---
Because int b{2.3} absolutely definitely loses precision, and since it's a
constant you can just fix the code.

For {u} the compiler doesn't know whether it really narrows or not, since it
depends on un time values, so it gives you the benefit of the doubt.

The standard only requires a "diagnostic" for ill-formed code, and both
warnings and errors are diagnostics.

You can use https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html to
enable -Werror=narrowing just for your narrowing_check function if that's what
you want.

Reply via email to