Skip to content

[dcl.constexpr] A full-expression of initialization of a variable may be not an expression CWG3009 #4852

@frederick-vs-ja

Description

@frederick-vs-ja

Originally posted by @xmh0511 in #4837 (comment) and #4798.

Currently [dcl.constexpr] p10 says that in the defintion of a constexpr variable, the "full-expression of the initialization" shall be a constant expression. And according to [expr.const] p1, a constant expression is also an expression.

However, the "full-expression of the initialization" of a variable may be not an expression. It seems that "full-expression of the initialization" of a variable corresponds to the case specified in [intro.execution] p5 (5.4): an init-declarator (or a mem-initializer) is not an expression.

Note that [expr.const] p2 (2.2) uses "when interpretd as", which may imply that the "full-expression of its initialization" is not itself an expression.

Perhaps there are some contradictions currently, and we should clarify that

  • the full-expression of initialization of a variable is not itself an expression (and hence not a constant expression), and
  • how to "interpret" an initialization as an expression.

Metadata

Metadata

Assignees

No one assigned

    Labels

    cwgIssue must be reviewed by CWG.not-editorialIssue is not deemed editorial; the editorial issue is kept open for tracking.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions