Skip to content

CWG2548 Array prvalues and additive operators #1633

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

Closed
jensmaurer opened this issue Sep 15, 2023 · 3 comments
Closed

CWG2548 Array prvalues and additive operators #1633

jensmaurer opened this issue Sep 15, 2023 · 3 comments
Labels
EWG Evolution

Comments

@jensmaurer
Copy link
Member

jensmaurer commented Sep 15, 2023

CWG seeks advice from EWG whether support for array prvalue operands should be added for the indirection operator, the unary + operator, and the additive operators, along the lines of the wording in the issue. Similar to the [] operator, the specification of the indirection operation could be amended to yield an xvalue if the argument is a prvalue.

See CWG2548 for details.

@erichkeane
Copy link
Collaborator

EWG discussed CWG2548 during the Tuesday Morning session in Kona. The following poll was taken.

CWG2548 "Array prvalues and additive operators" is not a defect, this corner-case should not be supported given the direction given to P2865.

SF F N A SA
4 7 5 3 0

Result: Consensus

@tkoeppe
Copy link

tkoeppe commented Nov 8, 2023

Feedback from @zygoloid:

"CWG seeks advice from EWG whether support for array prvalue operands should be added for the indirection operator, the unary + operator, and the additive operators, along the lines of the wording above. Similar to the [] operator, the specification of the indirection operation could be amended to yield an xvalue if the argument is a prvalue. The unary + operator is occasionally used to force an array-to-pointer decay." -- sounds like CWG was asking for yes or no, not a fishing expedition.

CWG found three places where array prvalues didn't work, but array glvalues did, and wanted permission to make them work. And had wording changes to do so.

I think the reference to P2865 was a distraction; the CWG issue was about making prvalues decay in the same places where glvalues do (where there was a wording oversight preventing decay but implementations mostly did it anyway). P2865 was about not allowing arrays at all as operands of some operators.

@jfbastien
Copy link
Collaborator

EWG re-discussed given the above feedback. The issue might have been inadvertent but EWG likes the omission even if it is inconsistent. Adding the features for consistency does not seem useful, hence the resolution of "not a defect". That said, EWG could be convinced if a paper were presented to add the feature with compelling motivation.

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

No branches or pull requests

4 participants