[Bug c++/108538] unexpected -Wnarrowing errors in -fpermissive mode

2023-01-25 Thread stsp at users dot sourceforge.net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108538

--- Comment #4 from Stas Sergeev  ---
(In reply to Jonathan Wakely from comment #3)
> It seems like you might be expecting more from -fpermissive than it actually
> provides. It only affects a very limited set of diagnostics, and isn't a
> general "compile invalid code" switch.

I always used it to compile the
(valid) C code in C++ mode. I thought
that's what it is for. It violates the
C++ standard up and down. And that
-Wnarrowing case is "better" than others
because it was a warning in c++03.
Other problems that -fpermissive allows,
were always an errors in any c++ mode.

[Bug c++/108538] unexpected -Wnarrowing errors in -fpermissive mode

2023-01-25 Thread redi at gcc dot gnu.org via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108538

Jonathan Wakely  changed:

   What|Removed |Added

   Last reconfirmed||2023-01-25
 Status|UNCONFIRMED |NEW
   Severity|normal  |enhancement
 CC||jason at gcc dot gnu.org
 Ever confirmed|0   |1
   Keywords||diagnostic

--- Comment #3 from Jonathan Wakely  ---
(In reply to Stas Sergeev from comment #2)
> But I used -fpermissive mode to
> compile the mix of c/c++.

It seems like you might be expecting more from -fpermissive than it actually
provides. It only affects a very limited set of diagnostics, and isn't a
general "compile invalid code" switch.

It might be reasonable to make it affect narrowing diagnostics though. The
downside would be complicating the code by adding even more interactions
between different switches and dialects.

Confirming as an enhancement request to relax some narrowing errors with
-fpermissive, but C++ front end maintainers should decide whether that's
actually desirable.

[Bug c++/108538] unexpected -Wnarrowing errors in -fpermissive mode

2023-01-25 Thread stsp at users dot sourceforge.net via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108538

--- Comment #2 from Stas Sergeev  ---
(In reply to Andreas Schwab from comment #1)
> It depends on the selected C++ standard.  C++11 does not allow narrowing
> conversions unconditionally.

Yes, I am not disputing that.
But I used -fpermissive mode to
compile the mix of c/c++.
-fpermissive downgrades many C++
errors to a warning, eating most
of the regular C. So my question
here is explicitly about -fpermissive
mode, I think it should downgrade
-Wnarrowing back into the warning.

[Bug c++/108538] unexpected -Wnarrowing errors in -fpermissive mode

2023-01-25 Thread schwab--- via Gcc-bugs
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108538

--- Comment #1 from Andreas Schwab  ---
It depends on the selected C++ standard.  C++11 does not allow narrowing
conversions unconditionally.