codekingpro/portable-devtools
114k
1// run2 3// Copyright 2011 The Go Authors. All rights reserved.4// Use of this source code is governed by a BSD-style5// license that can be found in the LICENSE file.6 7// Test evaluation order in if condition.8 9package main10 11var calledf = false12 13func f() int {14 calledf = true15 return 116}17 18func g() int {19 if !calledf {20 panic("BUG: func7 - called g before f")21 }22 return 023}24 25func main() {26 // gc used to evaluate g() before f().27 if f() < g() {28 panic("wrong answer")29 }30}31 