C++ Logo

std-proposals

Advanced search

Re: [std-proposals] Declare as constinit, define as constexpr?

From: Ville Voutilainen <ville.voutilainen_at_[hidden]>
Date: Tue, 12 Dec 2023 21:37:50 +0200
On Tue, 12 Dec 2023 at 21:31, Thiago Macieira via Std-Proposals
<std-proposals_at_[hidden]> wrote:
>
> On Tuesday, 12 December 2023 16:17:37 -03 Greg Falcon via Std-Proposals wrote:
> > If folks here think this topic is ripe for consideration, I will happily
> > file a core language issue.
>
> It's not an issue. The standard is fine as it is written and you've found a
> couple of compiler bugs.
>
> If you want this to change, it needs to be a paper.

Sure. Just another lil' addition: quite like we can already write

extern const int x;

constexpr int x = 42;

it seems eminently reasonable to be able to write

extern constinit const int x;

constexpr int x = 42;

The "we can already write" bit convinces me that we should just do
this. But yes, agreed, as I said, a paper,
please, not an issue submission. Core would need to punt the issue to
Evolution to be handled as an extension
anyway, so better just write a paper and send it to Evolution.

Received on 2023-12-12 19:38:04