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
An expression E is a core constant expression unless the evaluation of E, following the rules of the abstract machine ([intro.execution]), would evaluate one of the following:
-[...]
5.14 in a lambda-expression, a reference to this or to a variable with automatic storage duration defined outside that lambda-expression, where the reference would be an odr-use ([basic.def.odr], [expr.prim.lambda]);
the variable value is an odr-use in the lambda-expression. The full-expression of the initialization of i should be a core constant expression, and evaluating the initialization will evaluate the lambda-expression. However, major implementations accept this example. The correct meaning can only be inferred from the note that follows p5.14. P5.14 is more or less unclear in this context. Using "in" is a bit strange, whether it means "evaluate in" or something else?
From the meaning implied by the note, I think p5.14 might be
In a lambda-expression, an expression Eo that potentially references *this or a variable with automatic storage duration defined outside that lambda-expression odr-uses the referenced entity, where Eo would be evaluated by a constant expression CE to which the lambda-expression is not being evaluated as part of.
The text was updated successfully, but these errors were encountered:
xmh0511
changed the title
[expr.const] p5.14 The rule about lambda-expression is not clear
[expr.const] p5.14 The rule about lambda-expression in a core constant expression is not clear
Apr 28, 2022
I believe this rule is talking about "core constant expression in a lambda-expression", not "lambda-expression in a core constant expression". Agree with you on the status that it's not clear.
[expr.const] p5.14 says
Consider this example:
the variable
value
is an odr-use in the lambda-expression. The full-expression of the initialization ofi
should be a core constant expression, and evaluating the initialization will evaluate the lambda-expression. However, major implementations accept this example. The correct meaning can only be inferred from the note that follows p5.14. P5.14 is more or less unclear in this context. Using "in" is a bit strange, whether it means "evaluate in" or something else?From the meaning implied by the note, I think p5.14 might be
The text was updated successfully, but these errors were encountered: