C++ Logo

sg16

Advanced search

Re: Support for volatile char* in static_assert messages by P2741R1 ("user-generated static_assert messages")

From: Corentin Jabot <corentinjabot_at_[hidden]>
Date: Sun, 5 Feb 2023 04:36:20 -0800
Hi,

I can't think of a single use case.
I also can't think of a single reason not to allow it, both because the
wording is consistent with other places where we just want to say we don't
care about CV qualifiers, and because disallowing here is just more
opinionated special cases that ends up being (very) slightly more work for
implementations, and arguably users, should anyone ever run into it (who
might wonder why the language disallows the use of a constexpr volatile
variable here specifically and anywhere else).





On Sun, Feb 5, 2023, 04:22 Daniel Krügler <daniel.kruegler_at_[hidden]> wrote:

> Hi,
>
> The paper
>
> https://isocpp.org/files/papers/P2741R1.pdf
>
> suggests the following grammar extension
>
> static_assert (constant-expression , constant-expression ) ;
>
> and goes on to constrain it as follows:
>
> "If a second constant-expression Msg is provided:
> [..]
> - Msg.data() shall be a well-formed constant expression whose type is
> cv char* or cv char8_t*, and
> [..]"
>
> I have a hard time to understand the motivation for possibly volatile
> qualified sequences of char or char8_t in static_assert messages. The
> paper does never mention the word volatile as part of its motivation.
>
> I would like to ask whether this wording suggestion in regard to
> volatile support is meant seriously and what the use cases are for
> volatile* char or even const volatile char* messages?
>
> Thanks,
>
> - Daniel
>

Received on 2023-02-05 12:36:32