Skip to content

CWG2571 [expr.sub] CWG2507 doesn't specify the evaluation order for default arguments #33

@cor3ntin

Description

@cor3ntin

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

Corentin Jabot

Reference (section label):

[expr.sub]

Link to reflector thread (if any):

https://lists.isocpp.org/core/2022/04/12363.php

Issue description:

While CWG2507 add the missing wording for defaults arguments in [over.sub], it doesn't specify their evaluation order
relative to the postfix-expression.
For consistency with call expressions - and because it was not suggested it should be changed - the expressions (in the expression lists) evaluation order is left indeterminate.

It is unclear to me whether [over.match.oper] needs further massaging to cover the evaluation order for a subscript expression with not exactly one expression in its expression-list.

Suggested resolution:

Modify 7.6.1.2 [expr.sub]/p1

A [subscript expression is a postfix expression followed by square brackets containing a possibly empty, 
comma-separated list of [initializer-clause]s which constitute the arguments to the subscript operator.
The [postfix-expression] is sequenced before each expression in the [expression-list]
+ and any default argument
. 

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