Bug 106658 - [C++23] P2590 - Explicit lifetime management
Summary: [C++23] P2590 - Explicit lifetime management
Status: NEW
Alias: None
Product: gcc
Classification: Unclassified
Component: c++ (show other bugs)
Version: unknown
: P3 normal
Target Milestone: ---
Assignee: Not yet assigned to anyone
Depends on:
Blocks: c++23-core
  Show dependency treegraph
Reported: 2022-08-16 17:33 UTC by Marek Polacek
Modified: 2023-07-14 15:23 UTC (History)
3 users (show)

See Also:
Known to work:
Known to fail:
Last reconfirmed: 2022-12-09 00:00:00


Note You need to log in before you can comment on or make changes to this bug.
Description Marek Polacek 2022-08-16 17:33:30 UTC
See <https://wg21.link/p2590>.
Comment 1 Richard Biener 2022-08-17 10:18:32 UTC
1.1 can be done without any code but 1.2 makes std::start_lifetime_at <T> (p)
retain the memory bit representation as initial value of the object?  The
paper mentions std::launder (ick), but I'm not sure how this is implementable
at all if not sufficiently restricted.
Comment 2 Richard Biener 2022-08-17 11:09:55 UTC
See for example PR101641 where even existing cases are currently impossible to get right.  So the only way to make std::start_lifetime_at <T> is to somehow
emit a hard memory barrier for the compiler _and_ make sure the underlying
storage is address-taken.  Note this barrier has to prevail in RTL as well
(I think std::launder is broken in this regard).
Comment 3 Andrew Pinski 2022-12-09 15:27:58 UTC