Title
Implicit calls of immediate functions
Status
c++23
Section
9.2.6 [dcl.constexpr]
Submitter
John Spicer

Created on 2019-03-27.00:00:00 last changed 16 months ago

Messages

Date: 2022-10-21.20:41:10

Proposed resolution (approved by CWG 2022-10-21):

Change in 7.7 [expr.const] paragraph 10 as follows:

An expression or conversion invocation is an immediate invocation if it is an explicit or implicit invocation of an immediate function and is not in an immediate function context. An immediate invocation shall be a constant expression.
Date: 2020-12-15.00:00:00

Additional note, July, 2019:

This issue would appear to be NAD because of the following wording from 7.7 [expr.const] paragraph 10:

An expression or conversion is an immediate invocation if it is an explicit or implicit invocation of an immediate function and is not in an immediate function context. An immediate invocation shall be a constant expression.
Date: 2022-11-15.00:00:00

[Accepted as a DR at the November, 2022 meeting.]

The intent for immediate functions is that they can only be called at compile time. That rule is enforced by the wording of 7.5.5 [expr.prim.id] paragraph 3:

An id-expression that denotes an immediate function (9.2.6 [dcl.constexpr]) shall appear as a subexpression of an immediate invocation or in an immediate function context (7.7 [expr.const]).

However, this restriction does not apply to implicit function calls such as constructor and operator invocations. Presumably some additional wording is needed for such cases.

History
Date User Action Args
2023-07-16 13:00:43adminsetstatus: open -> c++23
2023-07-16 13:00:43adminsetstatus: drwp -> open
2023-02-18 18:43:04adminsetstatus: dr -> drwp
2022-11-25 05:14:04adminsetstatus: ready -> dr
2022-10-21 20:41:10adminsetstatus: review -> ready
2022-10-21 17:58:11adminsetmessages: + msg6951
2020-12-15 00:00:00adminsetmessages: + msg6221
2019-03-27 00:00:00admincreate