Skip to content

CWG3176 [intro.execution] p16 sequencing default arguments #859

@leni536

Description

@leni536

Full name of submitter: Lénárd Szolnoki

Reference (section label): [intro.execution] p16

During the evaluation of an expression as a core constant expression ([expr.const]), evaluations of operands of individual operators and of subexpressions of individual expressions that are otherwise either unsequenced or indeterminately sequenced are evaluated in lexical order.

https://eel.is/c++draft/intro.execution#16

Issue description:

It is unclear how default arguments are sequenced according to this wording, as they don't appear lexically in a function call expression. The intent is probably to sequence these function arguments in parameter order.

My reading is that the sequencing of default arguments is either not specified by this paragraph, or they are usually sequenced before other arguments, as they lexically appear in the function declaration, which is usually lexically before the corresponding function call expression.

Suggested resolution:

During the evaluation of an expression as a core constant expression ([expr.const]), evaluations of operands of individual operators and of subexpressions of individual expressions that are otherwise either unsequenced or indeterminately sequenced are evaluated in lexical order. For a function call ([expr.call]) the initialization of parameters are sequenced in the lexical order the parameters are declared.

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