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

--- Comment #7 from Giuseppe D'Angelo <peppe at gcc dot gnu.org> ---
(In reply to Eric Gallager from comment #6)
> (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?

The problem isn't as much that it should be "enabled" (it's already part of
-Wnarrowing, which is enabled by default), but that it should be rejected. In
other words that an eventual new -Wpointer-bool-narrowing warning should be an
error by default. This at least would preserve compatibility, people could
still say -Wno-error=pointer-bool-narrowing if they need.

Reply via email to