Created on 2023-07-08.00:00:00 last changed 7 months ago
Proposed resolution (approved by CWG 2023-08-25):
Change in 7.7 [expr.const] paragraph 18 as follows:
An immediate function is a function or constructor that is
- declared with the consteval specifier, or
- an immediate-escalating function F whose function body contains an immediate-escalating expression E such that E's innermost enclosing non-block scope is F's function parameter scope. [ Note: Default member initializers used to initialize a base or member subobject (11.9.3 [class.base.init]) are considered to be part of the function body (9.5.1 [dcl.fct.def.general]). -- end note ]
Change in 9.5.1 [dcl.fct.def.general] paragraph 1 as follows:
Any informal reference to the body of a function should be interpreted as a reference to the non-terminal function-body, including, for a constructor, default member initializers or default initialization used to initialize a base or member subobject in the absence of a mem-initializer-id (11.9.3 [class.base.init]).
Suggested resolution [SUPERSEDED]:
Change in 7.7 [expr.const] paragraph 18 as follows:
An immediate function is a function or constructor that is
- declared with the consteval specifier, or
- an immediate-escalating function F whose function body contains an immediate-escalating expression E such that E's innermost enclosing non-block scope is F's function parameter scope, or
- an immediate-escalating default constructor of a class which has at least one non-static data member with an immediate-escalating default member initializer.
[Accepted as a DR at the November, 2023 meeting.]
Consider:
consteval int f(int);
struct S {
int x = f(0);
S() = default;
};
int main() {
S s; // OK?
}
Is S an immediate function?
The relevant specification is in 7.7 [expr.const] paragraph 18:
An immediate function is a function or constructor that is
- declared with the consteval specifier, or
- an immediate-escalating function F whose function body contains an immediate-escalating expression E such that E's innermost enclosing non-block scope is F's function parameter scope.
History | |||
---|---|---|---|
Date | User | Action | Args |
2024-04-05 21:43:46 | admin | set | status: dr -> drwp |
2023-12-19 10:15:28 | admin | set | status: ready -> dr |
2023-11-10 14:27:11 | admin | set | status: tentatively ready -> ready |
2023-08-26 21:49:54 | admin | set | messages: + msg7402 |
2023-08-26 21:49:54 | admin | set | status: open -> tentatively ready |
2023-07-11 06:02:12 | admin | set | messages: + msg7357 |
2023-07-08 00:00:00 | admin | create |