C++ Logo

std-discussion

Advanced search

Immediate functions (2)

From: Russell Shaw <rjshaw_at_[hidden]>
Date: Tue, 28 Jan 2025 21:48:13 +1100
Hi,

In [expr.const] p.154:

------------------------------------------------
An expression or conversion is immediate-escalating if it is not initially in an
immediate function context and it is either

— a potentially-evaluated id-expression that denotes an immediate function that
is not a subexpression of an immediate invocation, or

— an immediate invocation that is not a constant expression and is not a
subexpression of an immediate invocation.
------------------------------------------------

Thinking after rest this time, i think the second case means to say that
cefuncC() is not immediate-escalating.

consteval int cefuncP(int x) { return x; }
consteval int cefuncC() { return 0; }

int a = cefuncP(cefuncC());


I don't understand the first case:

"— a potentially-evaluated id-expression that denotes an immediate function that
is not a subexpression of an immediate invocation"

How can an id-expression denote an immediate function ? Isn't that a function
call like the second case ?

Received on 2025-01-28 10:48:21