constexpr function parameters
7.7 [expr.const]
Sean Hunt

Created on 2011-08-17.00:00:00 last changed 90 months ago


Date: 2012-02-15.00:00:00

[Voted into the WP at the February, 2012 meeting; moved to DR at the October, 2012 meeting.]

Date: 2011-08-15.00:00:00

Proposed resolution (August, 2011):

  1. Change the indicated bullet of 7.7 [expr.const] paragraph 2 as follows:

    • an invocation of a constexpr constructor with arguments that, when substituted by function invocation substitution (9.2.6 [dcl.constexpr]), do not produce all constant expressions for the constructor calls and full-expressions in the mem-initializers (including conversions); [Example:...

  2. Delete the final bullet of 9.2.6 [dcl.constexpr] paragraph 3 and move the deleted "." to the preceding sub-bullet:

    • every constructor call and implicit conversion used in initializing the return value (8.7.4 [stmt.return], 9.4 [dcl.init]) shall be one of those allowed in a constant expression (7.7 [expr.const]).

  3. Delete the final bullet of 9.2.6 [dcl.constexpr] paragraph 4 and change the preceding bullet as follows:

    • every assignment-expression that is an initializer-clause appearing directly or indirectly within a brace-or-equal-initializer for a non-static data member that is not named by a mem-initializer-id shall be a constant expression; and.

    • every implicit conversion used in converting a constructor argument to the corresponding parameter type and converting a full-expression to the corresponding member type shall be one of those allowed in a constant expression.

Date: 2011-08-17.00:00:00

Use of a parameter in a constexpr function appears to be ill-formed, because the lvalue-to-rvalue conversion on the parameter is not one of those permitted in a constant expression.

Date User Action Args
2014-03-03 00:00:00adminsetstatus: drwp -> cd3
2012-11-03 00:00:00adminsetstatus: dr -> drwp
2012-02-27 00:00:00adminsetmessages: + msg3797
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-09-06 00:00:00adminsetmessages: + msg3443
2011-08-17 00:00:00admincreate