Skip to content

CWG3009 [intro.execution] p5 full-expression vs. expression #460

@xmh0511

Description

@xmh0511

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

It seems that a full-expression is a set of grammar expressions or non-grammar expressions(i.e. implicitly function call expressions). However, a full-expression is defined as not necessarily an expression, per [intro.execution] p5

A full-expression is

  • [...]
  • an init-declarator ([dcl.decl]) or a mem-initializer ([class.base.init]), including the constituent expressions of the initializer,

However, somewhere in this document, we require a full-expression to be an expression to have a value category, for example, [dcl.constexpr] p6

In any constexpr variable declaration, the full-expression of the initialization shall be a constant expression ([expr.const]).

A constant expression is an expression that is defined by [expr.const] p13

A constant expression is either a glvalue core constant expression that refers to an entity that is a permitted result of a constant expression (as defined below), or a prvalue core constant expression whose value satisfies the following constraints

Anyway, only expression can it have a value category. Furthermore, the determination of a full-expression is significant for defining the destruction of a temporary object.

Temporary objects are destroyed as the last step in evaluating the full-expression ([intro.execution]) that (lexically) contains the point where they were created.

Suggested Resolution

Clearly define what a full-expression is. Is it a collection of evaluated expressions? Define the value category of a full-expression when we require it to have a value category in the rules. Moreover, define how a full-expression is determined from.

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