cplusplus / draft

C++ standards drafts
http://www.open-std.org/jtc1/sc22/wg21/
5.6k stars 739 forks source link

[expr.const] "Constant expression" is defined twice #6589

Open Eisenwave opened 9 months ago

Eisenwave commented 9 months ago

https://github.com/cplusplus/draft/blob/78635c91ac910e9c0953e1784eec648a214eb5ad/source/expressions.tex#L7298-L7302

https://github.com/cplusplus/draft/blob/78635c91ac910e9c0953e1784eec648a214eb5ad/source/expressions.tex#L7811-L7815

frederick-vs-ja commented 9 months ago

It seems to me that the first definition should be dropped, but we need to require copy elision not to be performed somewhere.


Can we augment the definition of core constant expression?

An expression E is a core constant expression unless the evaluation of E, with copy elision ([class.copy.elision]) disallowed, [...]

Eisenwave commented 9 months ago

with copy elision ([class.copy.elision]) disallowed

@frederick-vs-ja to be honest, I neither understand the current wording, nor the new wording you're proposing.

Does it mean that for the purpose of determining whether an expression is a constant expression, copy elision is disabled? Does it mean that performing copy elision disqualifies an expression from being a constant expresssion?

Honestly, each of these interpretations is reasonable given the current wording, and your wording, and I would aim to improve this. The former seems more plausible to me, and using the word disabled instead of disallowed would communicate this more clearly.