1 // run 2 3 // Copyright 2016 The Go Authors. All rights reserved. 4 // Use of this source code is governed by a BSD-style 5 // license that can be found in the LICENSE file. 6 7 // Ensure that inlined struct/array comparisons have the right side-effects. 8 9 package main 10 11 import "os" 12 13 func main() { 14 var x int 15 f := func() (r [4]int) { 16 x++ 17 return 18 } 19 _ = f() == f() 20 if x != 2 { 21 println("f evaluated ", x, " times, want 2") 22 os.Exit(1) 23 } 24 } 25