[Bug c++/124762] GCC should reject (not just warn) narrowing conversions from pointer to bool

egallager at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Sat Apr 4 14:42:09 GMT 2026


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

Eric Gallager <egallager at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |egallager at gcc dot gnu.org

--- Comment #6 from Eric Gallager <egallager at gcc dot gnu.org> ---
(In reply to Giuseppe D'Angelo from comment #5)
> Sure thing; the pointer->bool narrowing only exists since C++20, as I've
> pointed out. In earlier modes that's well-formed and should be accepted; but
> maybe issue a warning as part of -Wc++20-compat...?

Maybe a separate -Wpointer-bool-narrowing flag that's EnabledBy -Wc++20-compat?


More information about the Gcc-bugs mailing list