Created on 2013-03-11.00:00:00 last changed 141 months ago
Rationale (April, 2013):
In the cited example, the constructor is constexpr; it simply cannot be used in a constant expression. The error would be detected at the time of such a use.
Consider the following example:
struct A { template <class T> constexpr void* f(T) { return nullptr; } A* ap = (A*)f(A()); template <class ...T> constexpr A() {} };
A default constructor template instance would recurse infinitely via the member initializer for A::ap. However, since it's a template, by 9.2.6 [dcl.constexpr] paragraph 6, that would just mean that the instance shouldn't be treated as constexpr.
Is an implementation really expected to handle that? In effect, we have to try to evaluate the expression and if that fails, nullify the constexpr-ness of the A::A<>() instance, and re-examine the initializer with the new understanding of that instance?
History | |||
---|---|---|---|
Date | User | Action | Args |
2013-05-03 00:00:00 | admin | set | messages: + msg4438 |
2013-05-03 00:00:00 | admin | set | status: open -> nad |
2013-03-11 00:00:00 | admin | create |