You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The immediate subexpressions of an expression E are
the constituent expressions of E's operands ([expr.prop]),
any function call that E implicitly invokes,
if E is a lambda-expression ([expr.prim.lambda]), the initialization of the entities captured by copy and the constituent expressions of the initializer of the init-captures,
if E is a function call or implicitly invokes a function, the constituent expressions of each default argument ([dcl.fct.default]) used in the call, or
if E creates an aggregate object ([dcl.init.aggr]), the constituent expressions of each default member initializer ([class.mem]) used in the initialization.
A subexpression of an expression E is an immediate subexpression of E or a subexpression of an immediate subexpression of E.
Consider this example:
int a = 0, b = 1;
a+b; // #1
[basic.lval] p6 says
Whenever a glvalue appears as an operand of an operator that expects a prvalue for that operand, the lvalue-to-rvalue, array-to-pointer, or function-to-pointer standard conversions are applied to convert the expression to a prvalue.
So, any of the operands at #1 is the prvalue rather than a or b. According to the first bullet, such two prvalues are the operands. The constituent expression of the prvalue is itself. That means a and b are not subexpressions of the expression at #1. However, if the conversion is a user-defined conversion, the associated function call is a subexpression, as per the second bullet.
Moreover, this can introduce a doubt, when we say
the full-expression of its initialization is a constant expression when interpreted as a constant-expression
What can be subexpressions of the constant-expression when built-in conversion applies?
constint v = 0;
constexprint i = v;
The initialization should be the prvalue that results from applying lvalue-to-rvalue conversion to v, In analogy to above, v is not a subexpression in that constant-expression.
The text was updated successfully, but these errors were encountered:
[intro.execution] p3 says
Consider this example:
[basic.lval] p6 says
So, any of the operands at
#1
is the prvalue rather thana
orb
. According to the first bullet, such two prvalues are the operands. The constituent expression of the prvalue is itself. That meansa
andb
are not subexpressions of the expression at#1
. However, if the conversion is a user-defined conversion, the associated function call is a subexpression, as per the second bullet.Moreover, this can introduce a doubt, when we say
What can be subexpressions of the constant-expression when built-in conversion applies?
The initialization should be the prvalue that results from applying lvalue-to-rvalue conversion to
v
, In analogy to above,v
is not a subexpression in that constant-expression.The text was updated successfully, but these errors were encountered: