1// run
2
3// Copyright 2011 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// Test evaluation order.
8
9package main
10
11var calledf int
12
13func f() int {
14	calledf++
15	return 0
16}
17
18func g() int {
19	return calledf
20}
21
22var xy string
23
24func x() bool {
25	for false {
26	} // no inlining
27	xy += "x"
28	return false
29}
30
31func y() string {
32	for false {
33	} // no inlining
34	xy += "y"
35	return "abc"
36}
37
38func main() {
39	if f() == g() {
40		panic("wrong f,g order")
41	}
42
43	if x() == (y() == "abc") {
44		panic("wrong compare")
45	}
46	if xy != "xy" {
47		panic("wrong x,y order")
48	}
49}
50