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

--- Comment #18 from Manuel López-Ibáñez <manu at gcc dot gnu.org> ---
(In reply to Manuel López-Ibáñez from comment #16)
> What is printed with -Wno-error=narrowing ?

I'm also a bit afraid of how setting pedantic-errors in this way interacts with
the #pragma GCC diagnostics. Wouldn't it be better to reclassify -Wnarrowing as
an error (see diagnostic_classify_diagnostic) then simulate a #pragma GCC
diagnostics pop to restore the previous state? The problem is the order in
which the re-classification happens, which should appear as if it happened in
the command-line and not at the point of warning, but
diagnostic_classify_diagnostic assumes #pragmas are handled in the order given
in the source code.

Another alternative, perhaps simpler, would be to have a different option
-Wnarrowing-strict, which by default is -Werror=narrowing-strict (see
Werror-implicit-function-declaration) and it is enabled by -Wnarrowing. This
way, everything should work as expected (unless latent bugs in the options
handling machinery for not passing the error/warning state correctly when
enabling dependant options).

An even simpler options is to put this under -fpermissive so people realize
that what they are doing is very wrong according to the standard (if it is not
very wrong, then why error and not just pedwarn?).

Reply via email to