This is an unofficial snapshot of the ISO/IEC JTC1 SC22 WG21 Core Issues List revision 115c. See http://www.open-std.org/jtc1/sc22/wg21/ for the official list.
2024-09-25
[Voted into the WP at the March, 2011 meeting.]
6.8 [basic.types] paragraph 10 requires that a class have at least one constexpr constructor other than the copy constructor in order to be considered a literal type. However, a constexpr constructor template might be instantiated in such a way that the constexpr specifier is ignored (9.2.6 [dcl.constexpr] paragraph 5) . It is therefore not known whether a class with a constexpr constructor template is a literal type or not until the constructor template is specialized, which could mean that an example like
struct IntValue { template<typename T> constexpr IntValue(T t) : val(t) { } constexpr intmax_t get_value() { return val; } private: intmax_t val; };
is ill-formed, because it is an error to declare a member function (like get_value()) of a non-literal class to be constexpr (9.2.6 [dcl.constexpr] paragraph 6).
6.8 [basic.types] paragraph 10 should be revised so that either a constexpr constructor or constexpr constructor template allows a class to be a literal type.
Proposed resolution (November, 2010):
Change 6.8 [basic.types] paragraph 10 as follows:
A type is a literal type if it is:
a scalar type; or
a class type (Clause 11 [class])
withthat
a trivial copy constructor,
no non-trivial move constructor,has a trivial destructor,
a trivial default constructor oris an aggregate type (9.4.2 [dcl.init.aggr]) or has at least one constexpr constructorother than theor constructor template that is not a copy or move constructor, andhas all non-static data members and base classes of literal types; or
an array of literal type.
This resolution also resolves issues 1071 and 1198.