-
Notifications
You must be signed in to change notification settings - Fork 757
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] Check the result object of a prvalue #6267
base: main
Are you sure you want to change the base?
[expr.const] Check the result object of a prvalue #6267
Conversation
A prvalue may not have a result object, at least in the scalar case. |
Although temporary materialization doesn't happen in some cases, I think it's harmless to require the result object for the purpose of checking whether the prvalue is a constant expression. |
1bdc388
to
7eb1d52
Compare
This comment was marked as outdated.
This comment was marked as outdated.
7eb1d52
to
95981de
Compare
This comment was marked as outdated.
This comment was marked as outdated.
95981de
to
bd7b1ff
Compare
Rebased and force-pushed. @jensmaurer @tkoeppe |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is an improvement.
I disagree. Here, for example, we surely want consteval int f() { return 42; };
int x = f() + 1; The existing wording isn't correct but this change takes it further in the wrong direction. |
Ok. Maybe just "result"? |
What's the harm if we require a result object for the determination? Did you mean that if we can't even say "a prvalue whose result object..." without actual temporary materialization? But IIUC in the scalar case, addtional temporary materialization shoudn't be observable. |
Fixes #5422.
The remain issue (modulo CWG2558) is that we shouldn't imply a prvalue is an object, which is not true since C++17.