Created on 2014-04-13.00:00:00 last changed 94 months ago
[Moved to DR at the November, 2014 meeting.]
Proposed resolution (June, 2014):
Change 9.2.6 [dcl.constexpr] paragraph 5 as follows:
For a non-template, non-defaulted constexpr function or a non-template, non-defaulted, non-inheriting constexpr constructor, if no argument values exist such that an invocation of the function or constructor could be an evaluated subexpression of a core constant expression (7.7 [expr.const]), or, for a constructor, a constant initializer for some object (6.9.3.2 [basic.start.static]), the program is ill-formed; no diagnostic required.
An example like
struct X { std::unique_ptr<int> p; constexpr X() { } };
is ill-formed because the X constructor cannot be used in a constant expression, because a constant expression cannot construct an object of a non-literal type like unique_ptr. This prevents use of something like
X x;
to guarantee constant-initialization.
History | |||
---|---|---|---|
Date | User | Action | Args |
2017-02-06 00:00:00 | admin | set | status: drwp -> cd4 |
2015-05-25 00:00:00 | admin | set | status: dr -> drwp |
2015-04-13 00:00:00 | admin | set | messages: + msg5359 |
2014-11-24 00:00:00 | admin | set | status: ready -> dr |
2014-07-07 00:00:00 | admin | set | messages: + msg5065 |
2014-07-07 00:00:00 | admin | set | status: open -> ready |
2014-04-13 00:00:00 | admin | create |