Closed
Description
The spec says the following:
The assignment proceeds in two phases. First, the operands of index expressions and pointer indirections (including implicit pointer indirections in selectors) on the left and the expressions on the right are all evaluated in the usual order. Second, the assignments are carried out in left-to-right order.
However, gopherjs evaluates lhs expressions at the time of assignment. In situations when one of the assignments modifies a variable referenced by another assignment, the result may be incorrect. For example:
package main
func main() {
type T struct{ i int }
var x T
p := &x
p, p.i = new(T), 4
println(p.i, x.i)
}
Go prints 0 4
GopherJS prints 4 0
Related: golang/go#23017.