1
0
mirror of https://github.com/golang/go synced 2024-11-21 18:24:46 -07:00

test: add test for order of evaluation of map index on left of =

Gccgo used to get this wrong.

R=golang-dev, bradfitz
CC=golang-dev
https://golang.org/cl/6121044
This commit is contained in:
Ian Lance Taylor 2012-04-24 10:17:26 -07:00
parent 78e4d1752e
commit 76490cffaf

View File

@ -19,6 +19,7 @@ func main() {
p6() p6()
p7() p7()
p8() p8()
p9()
} }
var gx []int var gx []int
@ -119,3 +120,11 @@ func p8() {
i := 0 i := 0
i, x[i], x[5] = 1, 100, 500 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])
}
}