C++ Logo

liaison

Advanced search

Re: [isocpp-wg14/wg21-liaison] WG21 feedback required - N3538

From: Jonathan Wakely <cxx_at_[hidden]>
Date: Mon, 5 May 2025 17:41:44 +0100
On Mon, 5 May 2025, 15:31 Ville Voutilainen via Liaison, <
liaison_at_[hidden]> wrote:

> On Mon, 5 May 2025 at 15:48, Nina Dinka Ranns via Liaison
> <liaison_at_[hidden]> wrote:
> >
> > Hi all,
> >
> > there's a paper targeting WG14 regarding static assertions in
> expressions.
> > https://www.open-std.org/jtc1/sc22/wg14/www/docs/n3538.pdf
> >
> > The author would appreciate WG21 feedback. I encourage you to take a
> moment to read the paper and share your thoughts.
>
> Here's two thoughts:
>
> 1) the proposal is that a static_assert results in an int. Why not bool?
>
> 2) for C++, the proposal is far less compelling in general, because we
> can already lambda-wrap non-expressions into expressions.
>

And we have little need for function-like macros. We have constexpr
functions as well as lambda expressions. You can easily put a static_assert
in there.

I see supporting one-liners mixing logic and static_assert in a single
expression as having negative value for C++. It just obfuscates code that
could be written differently with no loss of expressivity or performance.

Received on 2025-05-05 16:42:01