Created on 2012-10-16.00:00:00 last changed 140 months ago
Rationale (April, 2013):
The specification is as intended. The defaulted constructor will be constexpr if it can be, so it should not be explicitly declared constexpr in order to avoid the problems mentioned.
According to 9.5.2 [dcl.fct.def.default] paragraph 2,
An explicitly-defaulted function may be declared constexpr only if it would have been implicitly declared as constexpr...
This is relevant for wrapper functions like
template<class T> struct wrap { T t; constexpr wrap() = default; constexpr wrap(const wrap&) = default; };
It is not clear how the new wording for constexpr member functions of class templates in the proposed resolution issue 1358 affects this:
If the instantiated template specialization of a constexpr function template or member function of a class template would fail to satisfy the requirements for a constexpr function or constexpr constructor, that specialization is still a constexpr function or constexpr constructor, even though a call to such a function cannot appear in a constant expression.
History | |||
---|---|---|---|
Date | User | Action | Args |
2013-05-03 00:00:00 | admin | set | messages: + msg4440 |
2013-05-03 00:00:00 | admin | set | status: open -> nad |
2012-10-16 00:00:00 | admin | create |