C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Lakos rule

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Thu, 21 Dec 2023 19:52:39 +0200
On Thu, 21 Dec 2023 at 19:03, Jason McKesson via Std-Proposals
<std-proposals_at_[hidden]> wrote:
> If the "throws: nothing" functions actually do throw (violating the
> standard, BTW)

It isn't a violation of the standard. The Lakos Rule part where you
don't have a noexcept in the spec applies to narrow contracts,
the function will need to have Preconditions to have a narrow
contract, and calling it violating those Preconditions is UB.
The implementation can do anything, including throwing an exception.

Received on 2023-12-21 17:52:52