Function invocation substitution of this
9.2.6 [dcl.constexpr]
Jens Maurer

Created on 2011-08-18.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:

    • this (7.5 [expr.prim] _N4567_.5.1.1 [expr.prim.general]) unless it appears as the postfix-expression in a class member access expression, including the result of the implicit transformation in the body of a non-static member function (11.4.3 [class.mfct.non-static]) [Note: when evaluating a constant expression, function invocation substitution (9.2.6 [dcl.constexpr]) replaces each occurrence of this in a constexpr member function with a pointer to the class object. —end note];

  2. Change 9.2.6 [dcl.constexpr] paragraph 5 as follows (converting the running text into a bulleted list):

  3. Function invocation substitution for a call of a constexpr function or of a constexpr constructor means:

    • implicitly converting each argument to the corresponding parameter type as if by copy-initialization,91

    • substituting that converted expression for each use of the corresponding parameter in the function-body,

    • in a member function, substituting for each use of this (_N4868_. [class.this]) a prvalue pointer whose value is the address of the object for which the member function is called, and

    • for in a constexpr functions, implicitly converting the resulting returned expression or braced-init-list to the return type of the function as if by copy-initialization.

    Such substitution...

This resolution also resolves issues 1264 and 1367.

Date: 2011-08-18.00:00:00

Function invocation substitution (9.2.6 [dcl.constexpr] paragraph 5) seems underspecified with respect to this.

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: + msg3801
2012-02-27 00:00:00adminsetstatus: ready -> dr
2011-09-06 00:00:00adminsetmessages: + msg3451
2011-08-18 00:00:00admincreate