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
This commit is contained in:
Russ Cox 2010-05-24 14:31:43 -07:00
parent 21518ea2af
commit e7561de09a

View file

@ -3017,9 +3017,10 @@ The right operand is evaluated conditionally.
<p>
The address-of operator <code>&amp;</code> generates the address of its operand,
which must be <i>addressable</i>,
that is, either a variable, pointer indirection, array or slice indexing
operation,
or a field selector of an addressable struct operand.
that is, either a variable, pointer indirection, or slice indexing
operation;
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
operator <code>*</code> retrieves the value pointed
to by the operand.