C++ Logo


Advanced search

Subject: Re: [SG12] Missing non-void return on some paths
From: Nevin Liber (nevin_at_[hidden])
Date: 2021-05-08 14:31:37

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.

 Nevin ":-)" Liber  <mailto:nevin_at_[hidden] <nevin_at_[hidden]>>

SG12 list run by sg12-owner@lists.isocpp.org