[dcl.constexpr] A full-expression of initialization of a variable may be not an expression CWG3009
Nobody has claimed this yet.
- Dominant language
- TeX
- Stars
- 221
- Forks
- 813
- Avg merge
- 16h 4m
- Merged PRs (30d)
- 36
Description
Originally posted by @xmh0511 in https://github.com/cplusplus/draft/issues/4837#issuecomment-908096967 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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Read [dcl.constexpr] p10, [expr.const] p1 and p2 (2.2), and [intro.execution] p5 (5.4), along with the linked issues #4837 and #4798. Determine whether an initialization full-expression is itself an expression and clarify how an initialization is interpreted as an expression, resolving the apparent contradictions.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- documentation
- Issue type
- Documentation
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100