Date: Sat, 8 May 2021 14:31:37 -0500
On Sat, May 8, 2021 at 2:18 PM Jonathan Wakely <cxx_at_[hidden]> wrote:
>
> I think adding std::unreachable(); after the assertion would work for that
> purpose.
>
If I'm reading it correctly, the paper says that unreachable is not allowed
in a constant expression (because calling it is UB). That is a breaking
change for calling assert in a constexpr context [assertions.assert]. And
even if we fix the one in the standard, how can users write their own?
Don't get me wrong; I'd love to see this become a required warning/error if
we can do it. But the devil is always in the details.
>
> I think adding std::unreachable(); after the assertion would work for that
> purpose.
>
If I'm reading it correctly, the paper says that unreachable is not allowed
in a constant expression (because calling it is UB). That is a breaking
change for calling assert in a constexpr context [assertions.assert]. And
even if we fix the one in the standard, how can users write their own?
Don't get me wrong; I'd love to see this become a required warning/error if
we can do it. But the devil is always in the details.
-- Nevin ":-)" Liber <mailto:nevin_at_[hidden] <nevin_at_[hidden]>> +1-847-691-1404
Received on 2021-05-08 14:32:16