C++ Logo

std-proposals

Advanced search

Re: [std-proposals] noexcept(override) and maybe noexcept(auto)?

From: Magnus Fromreide <magfr_at_[hidden]>
Date: Sat, 24 Aug 2024 05:51:28 +0200
On Fri, Aug 23, 2024 at 10:09:28AM +0200, Robin Savonen Söderholm via Std-Proposals wrote:
> Hi!
>
> Feels like I am spamming this mailing list, please tell me if you think
> that I throw ideas at you at a too immature phase...
>
> But I just recently got a compilation error when running my code through
> gcc after it been developed with MSVC about noexcept-specifier (or rather
> lack-of).
> It is about the std::exception::what() in this case, that is marked with
> `noexcept` with GNU c++ library, but not with MSVC:s (2022) library. I
> solved the issue for now by using the noexcept-operator, doing
> `noexcept(noexcept(std::exception::what()))`, but I think that a nice
> syntax that could be used in such cases are `noexcept(override)` to "copy"

override is not a reserved word, it is an identifier with a special meaning so
your proposed syntax could change conforming programs (but I certainly hope
it won't change any real world code)

--- valid c++ today ---
constexpr bool override = true;

void f() noexcept(override) { }
--- end example ---

/MF

Received on 2024-08-24 03:51:34