Commit e7561de0 authored by Russ Cox's avatar Russ Cox

spec: index of non-addressable array is not addressable

Motivated by:

func f() []int
func g() [10]int

f()[1] = 1  // ok
g()[1] = 1 // ERROR

R=gri
CC=golang-dev
https://golang.org/cl/1278041
parent 21518ea2
...@@ -3017,9 +3017,10 @@ The right operand is evaluated conditionally. ...@@ -3017,9 +3017,10 @@ The right operand is evaluated conditionally.
<p> <p>
The address-of operator <code>&amp;</code> generates the address of its operand, The address-of operator <code>&amp;</code> generates the address of its operand,
which must be <i>addressable</i>, which must be <i>addressable</i>,
that is, either a variable, pointer indirection, array or slice indexing that is, either a variable, pointer indirection, or slice indexing
operation, operation;
or a field selector of an addressable struct operand. or a field selector of an addressable struct operand;
or an array indexing operation of an addressable array.
Given an operand of pointer type, the pointer indirection Given an operand of pointer type, the pointer indirection
operator <code>*</code> retrieves the value pointed operator <code>*</code> retrieves the value pointed
to by the operand. to by the operand.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment