Created on 2019-03-13.00:00:00 last changed 25 months ago
Rationale (July, 2019)
The example is valid; the constant evaluation is the entire initialization constexpr A a1, thus the temporary bound to a1.temporary started its lifetime within the constant evaluation.
There is implementation divergence with respect to an example like:
constexpr int f(int &r) { r *= 9; return r - 12; }
struct A { int &&temporary; int x; int y; };
constexpr A a1 = { 6, f(a1.temporary), a1.temporary }; // #1
Some implementations accept this code and others say that a1.temporary is not a constant expression in the initializer at #1.
History | |||
---|---|---|---|
Date | User | Action | Args |
2022-11-27 19:55:08 | admin | set | messages: + msg7065 |
2022-11-27 19:55:08 | admin | set | status: open -> nad |
2019-03-13 00:00:00 | admin | create |