Created on 2014-05-02.00:00:00 last changed 139 months ago
Rationale (June, 2014):
The requirements for a constexpr constructor in 9.2.6 [dcl.constexpr] do not require that an initializer be constant at the point of definition, similar to the provision for mutually-recursive constexpr functions, which require that at least one of the functions will contain a reference to a not-yet-defined constexpr function. Determination of whether an expression is constant or not is made in the context in which the expression appears, by which time the constant value of x in the exampe above is known. CWG feels that the current wording is clear enough that the example is well-formed.
In an example like
extern int const x;
struct A {
constexpr A () { }
int value = x;
};
int const x = 123;
constexpr A a;
it is not clear whether the constructor for A is well-formed (because the initialization for x has not yet been seen) and whether that constant value is used in the initialization of a. There is implementation divergence on these questions.
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2014-07-07 00:00:00 | admin | set | messages: + msg5112 |
| 2014-07-07 00:00:00 | admin | set | status: open -> nad |
| 2014-05-02 00:00:00 | admin | create | |