Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
Eisenwave opened this issue Oct 5, 2023 · 2 comments
Open

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

Eisenwave opened this issue Oct 5, 2023 · 2 comments

Comments

@Eisenwave
Copy link
Contributor

draft/source/expressions.tex

Lines 7298 to 7302 in 78635c9

Expressions that satisfy these requirements,
assuming that copy elision\iref{class.copy.elision} is not performed,
are called
\indexdefn{expression!constant}%
\defnx{constant expressions}{constant expression}.

draft/source/expressions.tex

Lines 7811 to 7815 in 78635c9

A \defnadj{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:

@frederick-vs-ja
Copy link
Contributor

frederick-vs-ja commented Oct 5, 2023

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
Copy link
Contributor Author

Eisenwave commented Oct 6, 2023

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants