]> Cypherpunks repositories - gostls13.git/commitdiff
spec: index of non-addressable array is not addressable
authorRuss Cox <rsc@golang.org>
Mon, 24 May 2010 21:31:43 +0000 (14:31 -0700)
committerRuss Cox <rsc@golang.org>
Mon, 24 May 2010 21:31:43 +0000 (14:31 -0700)
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

doc/go_spec.html

index 39067fab8a1d4e9ff57b527d1d4493a5cbe3983e..156ee6a45b15e581d5e8b05dce35907fbb20db55 100644 (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.