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

[dcl.array]: delete note about non-modifiability of arrays #2048

Merged
merged 1 commit into from May 7, 2018

Conversation

languagelawyer
Copy link
Contributor

@languagelawyer languagelawyer commented Apr 21, 2018

[basic.lval]/10 says about (non-)modifiable lvalues (http://eel.is/c++draft/basic.lval#def:modifiable):

An lvalue is modifiable unless its type is const-qualified or is a function type.

Nothing about arrays. 2 other places in [basic.lval] which mention arrays are:

[ Note: Except when the prvalue is the operand of a decltype-specifier, a prvalue of class or array type always has a result object.
For a discarded prvalue, a temporary object is materialized; see [expr.prop]. — end note ]

[ Note: A glvalue may have complete or incomplete non-void type. Class and array prvalues can have cv-qualified types; other prvalues always have cv-unqualified types. See [expr.prop]. — end note]

Probably the statement is an artifact from the stone age, when [basic.lval] contained

14If an expression can be used to modify the object to which it refers,
the expression is called modifiable.

Well, one can't assign to (==modify) an array using an lvalue of array type (although nobody knows why), so the statement referring to [basic.lval] made sense at that time.

But currently, the statement "Objects of array types cannot be modified" is complete nonsense in this form; see also #1988 (comment)

[basic.lval]/10 says about (non-)modifiable lvalues (http://eel.is/c++draft/basic.lval#def:modifiable):
> An lvalue is modifiable unless its type is const-qualified or is a function type.

Nothing about arrays. 2 other places in [basic.lval] which mention arrays are:

> [ Note: Except when the prvalue is the operand of a decltype-specifier, a prvalue of class or **array** type always has a result object.
For a discarded prvalue, a temporary object is materialized; see [expr.prop]. — end note ]

> [ Note: A glvalue may have complete or incomplete non-void type. Class and **array** prvalues can have cv-qualified types; other prvalues always have cv-unqualified types. See [expr.prop]. — end note]
@zygoloid zygoloid merged commit 8d5a7ce into cplusplus:master May 7, 2018
@languagelawyer languagelawyer deleted the patch-1 branch May 7, 2018 10:15
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

Successfully merging this pull request may close these issues.

None yet

2 participants