Created on 2026-05-22.00:00:00 last changed yesterday
Suggested resolution:
Insert a bullet after 7.7.2 [expr.const.core] bullet 2.18 as follows:
- ...
- an invocation of a destructor (11.4.7 [class.dtor]) or a function call whose postfix-expression names a pseudo-destructor (7.6.1.3 [expr.call]), in either case for an object whose lifetime did not begin within the evaluation of E;
- starting the lifetime of an object O such that the lifetime of the complete object of O did not begin within the evaluation of E;
- ...
(From LWG issue 4578.)
Consider:
union U { int x = 10; float f[2]; };
U u;
consteval {
std::start_lifetime(u.f); // changes active member
};
void foo() {
U u;
constexpr int x = (std::start_lifetime(u.f), 10);
}
There is no prohibition against explicitly starting the lifetime of a runtime object during constant evaluation.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2026-05-31 22:13:10 | admin | set | messages: + msg8592 |
| 2026-05-22 00:00:00 | admin | create | |