C++ Logo

std-discussion

Advanced search

It seems a vague definition for an immediate subexpression of a braced-init-list

From: jim x <xmh970252187_at_[hidden]>
Date: Wed, 13 Jan 2021 10:23:45 +0800
Hi, everyone. I have a doubt about this concept. That is, one of the
bullets in the definition of potentially constant evaluated, which is:
[expr.const#15.3] <https://eel.is/c++draft/expr.const#15.3>
> an immediate subexpression of a *braced-init-list *

However, there's no such definition in the standard that describes what are
immediate subexpressions of a braced-init-list. The definition of immediate
subexpressions of *an expression E* is defined as:
[basic.exec#intro.execution-3]
<https://eel.is/c++draft/basic.exec#intro.execution-3>
The *immediate subexpressions*
<https://eel.is/c++draft/basic.exec#def:immediate_subexpression> of an
expression E are
1. the constituent expressions of E's operands
2. any function call that E implicitly invokes,
3. if E is a *lambda-expression*
<https://eel.is/c++draft/expr.prim.lambda.general#nt:lambda-expression> (
[expr.prim.lambda] <https://eel.is/c++draft/expr.prim.lambda>), the
initialization of the entities captured by copy and the constituent
expressions of the *initializer*
<https://eel.is/c++draft/dcl.init.general#nt:initializer> of the
*init-capture*
<https://eel.is/c++draft/expr.prim.lambda.capture#nt:init-capture>*s *
*4. *if E is a function call <https://eel.is/c++draft/expr.call> or
implicitly invokes a function, the constituent expressions of each default
argument ([dcl.fct.default] <https://eel.is/c++draft/dcl.fct.default>) used
in the call, or
5. if E creates an aggregate object ([dcl.init.aggr]
<https://eel.is/c++draft/dcl.init.aggr>), the constituent expressions of
each default member initializer ([class.mem]
<https://eel.is/c++draft/class.mem>) used in the initialization.
<https://eel.is/c++draft/basic.exec#intro.execution-3.sentence-1>

The key point here is a *braced-init-list* is not an expression, how to
determine what are its immediate subexpressions? I guess Does the intent of
that rule mean these constitute expressions of a braced-init-list? If not
that, I think it's necessary to word a rule that clarifies what are
immediate subexpressions of a *braced-init-list. *

Received on 2021-01-12 20:23:59