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

--- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Martin Sebor from comment #1)
> Confirmed, thanks!  Just to make sure I understand: we want a warning for
> the operator new declaration (irrespective of its definition) because the
> nothrow_t argument suggests it doesn't throw but the absence of noexcept
> implies it might.  I.e., the warning can be emitted as early as in the C++
> front end.

Yes, you understood exactly.

Additionally, we should not warn if the function has an explicit
noexcept(false).

I think it's reasonable to add this to -Wall. In the unlikely event that the
user really does want a throwing operator new that takes a std::nothrow_t
parameter, I think requiring noexcept(false) to suppress the warning is
reasonable. It's confusing/misleading otherwise.

Reply via email to