]> Cypherpunks.ru repositories - gostls13.git/commitdiff
test: add test for order of evaluation of map index on left of =
authorIan Lance Taylor <iant@golang.org>
Tue, 24 Apr 2012 17:17:26 +0000 (10:17 -0700)
committerIan Lance Taylor <iant@golang.org>
Tue, 24 Apr 2012 17:17:26 +0000 (10:17 -0700)
Gccgo used to get this wrong.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6121044

test/reorder.go

index 007039e8a9b0fe10e8c6b1aba352138fff299124..0cdeebd0f3160f4c303bf65383adeb6375c62c07 100644 (file)
@@ -19,6 +19,7 @@ func main() {
        p6()
        p7()
        p8()
+       p9()
 }
 
 var gx []int
@@ -119,3 +120,11 @@ func p8() {
        i := 0
        i, x[i], x[5] = 1, 100, 500
 }
+
+func p9() {
+       m := make(map[int]int)
+       m[0] = len(m)
+       if m[0] != 0 {
+               panic(m[0])
+       }
+}