C++ Logo


Advanced search

Subject: Re: [std-proposals] proposal: [[noexcept]] attribute
From: Gašper Ažman (gasper.azman_at_[hidden])
Date: 2019-11-13 13:09:02


people use lambdas as noexcept blocks:
[&]() noexcept { return f(); }();

If you care a lot about this you might want to join the discussions about
noexcept blocks, through I'm not sure who's the most involved in them.


On Wed, Oct 23, 2019 at 2:47 PM Andrey Semashev via Std-Proposals <
std-proposals_at_[hidden]> wrote:

> On 2019-10-23 15:53, Walt Karas via Std-Proposals wrote:
> > I propose adding noexcept as an attribute. It would be used after a
> > function call to a noexcept(false) function. It asserts that, in that
> > context, the function will not throw any exceptions.
> noexcept specifier not only documents the function as non-throwing. It
> also guarantees that the function won't throw (the program will
> terminate if it does). This kind of guarantee cannot be implemented with
> an attribute because it is not allowed to have a mandatory behavior.
> You could implement what you propose as a library extension:
> template< typename F >
> auto invoke_noexcept(F f) noexcept
> {
> return f();
> }
> > I also propose
> > that, if a function that only has calls to noexcept functions, or calls
> > with the [[noexcept]] attribute, the compiler must emit a diagnostic
> > (presumably a warning) if the function is noexcept(false).
> That means all current code will suddenly emit tons of warnings. Thanks,
> but no.
> --
> Std-Proposals mailing list
> Std-Proposals_at_[hidden]
> https://lists.isocpp.org/mailman/listinfo.cgi/std-proposals

STD-PROPOSALS list run by std-proposals-owner@lists.isocpp.org

Standard Proposals Archives on Google Groups