Title
Instantiations of constexpr templates that cannot appear in constant expressions
Status
cd4
Section
9.2.6 [dcl.constexpr]
Submitter
Richard Smith

Created on 2014-02-17.00:00:00 last changed 49 months ago

Messages

Date: 2016-01-15.00:00:00

Proposed resolution (January, 2016):

Add the following bullet following 7.7 [expr.const] bulllet 2.3:

A conditional-expression e is a core constant expression unless the evaluation of e, following the rules of the abstract machine (6.9.1 [intro.execution]), would evaluate one of the following expressions:

  • ...

  • an invocation of an undefined constexpr function or an undefined constexpr constructor;

  • an invocation of an instantiated constexpr function or constexpr constructor that fails to satisfy the requirements for a constexpr function or constexpr constructor (9.2.6 [dcl.constexpr]);

  • ...

Date: 2016-02-15.00:00:00

[Adopted at the February, 2016 meeting.]

According to 9.2.6 [dcl.constexpr] paragraph 6,

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.

The restriction on appearing in a constant expression assumes the previous wording that made such a specialization non-constexpr, and a call to a non-constexpr function cannot appear in a constant expression. With the current wording, however, there is no normative restriction against calls to such specializations. 7.7 [expr.const] should be updated to include such a prohibition.

History
Date User Action Args
2017-02-06 00:00:00adminsetstatus: tentatively ready -> cd4
2016-02-15 00:00:00adminsetmessages: + msg5701
2016-02-15 00:00:00adminsetstatus: drafting -> tentatively ready
2014-07-07 00:00:00adminsetstatus: open -> drafting
2014-02-17 00:00:00admincreate