A type is a literal type if it is:Change in 5.19 expr.const paragraph 1:
- a scalar type; or
- a reference type; or
- ...
Change in 7.1.5 dcl.constexpr paragraph 1:
- an lvalue-to-rvalue conversion (4.1 conv.lval) unless it is applied to
- ...
- a glvalue of literal type that refers to a non-volatile temporary object whose lifetime has not ended, initialized with a constant expression;
[ Footnote: ... ]- an id-expression that refers to a variable or data member of reference type unless the reference has a preceding initialization, initialized with a constant expression
[ Footnote: ... ];
TheChange in 7.1.5 dcl.constexpr paragraph 3:constexpr
specifier shall be applied only to the definition ofan objecta variable, the declaration of a function or function template, or the declaration of a static data member of a literal type (3.9 basic.types). ...
Change in 7.1.5 dcl.constexpr paragraph 4:
- ...
- its return type shall be a literal type
or a reference to literal type- each of its parameter types shall be a literal type
or a reference to literal type- its function-body shall be
= delete
or a compound-statement of the form{ return expression ; }- ...
In a definition of aChange in 7.1.5 dcl.constexpr paragraph 8:constexpr
constructor, each of the parameter types shall be a literal type. In addition, either its function-body shall be= delete
or itThe definition of ashall satisfy the following constraints:constexpr
constructor
each of its parameter types shall be a literal type or a reference to literal type;- ...
Aconstexpr
specifier used in an object declaration declares the object asconst
. Such an object shall be initialized. If it is initialized by a constructor call, the constructor shall be a constexpr constructor and every argument to the constructor shall be a constant expression. Otherwise, or if aconstexpr
specifier is used in a reference declaration, every full-expression that appears in its initializer shall be a constant expression.