Skip to content

[intro.execution] p9 Are evaluations of these expressions that don't lexically appear in the full expression the associated evaluations of the full expression #956

Description

@xmh0511

Full name of submitter (unless configured in github; will be published with the issue): Jim X

Consider this example:

int value = 0;
void fun(){
  value = 1; // #1
}
int main(){
  fun(); // #2 
  value = 2; // #3
}

[intro.execution] p9 says:

Every value computation and side effect associated with a full-expression is sequenced before every value computation and side effect associated with the next full-expression to be evaluated.

In general, the associated evaluation of a full-expression refers to those of the expression that are part of the full-expression, and [intro.execution] p5 says

Conversions applied to the result of an expression in order to satisfy the requirements of the language construct in which the expression appears are also considered to be part of the full-expression. For an initializer, performing the initialization of the entity (including evaluating default member initializers of an aggregate) is also considered part of the full-expression.

The commonality of being part of the full-expression is that they lexically appear in the full-expression. For the above example, #1 doesn't syntactically appear in the full-expression at #2; is the evaluation of #1 the associated evaluation of the full-expression at #2?

A reasonable intent is that the evaluation at #1 is considered as an associated evaluation of the full-expression at #2 such that we can infer that #1 is sequenced-before #3.

Suggested Resolution:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions