2012-02-16 21:49:30 -07:00
|
|
|
// run
|
2009-12-03 00:54:51 -07:00
|
|
|
|
|
|
|
// Copyright 2009 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// function call arg reordering was picking out 1 call that
|
|
|
|
// didn't need to be in a temporary, but it was picking
|
|
|
|
// out the first call instead of the last call.
|
2015-02-06 05:44:39 -07:00
|
|
|
// http://golang.org/issue/370
|
2009-12-03 00:54:51 -07:00
|
|
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
var gen = 'a'
|
2010-03-30 11:34:57 -06:00
|
|
|
|
2009-12-03 00:54:51 -07:00
|
|
|
func f(n int) string {
|
2010-03-30 11:34:57 -06:00
|
|
|
s := string(gen) + string(n+'A'-1)
|
|
|
|
gen++
|
|
|
|
return s
|
2009-12-03 00:54:51 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
func g(x, y string) string {
|
|
|
|
return x + y
|
|
|
|
}
|
|
|
|
|
|
|
|
func main() {
|
2010-03-30 11:34:57 -06:00
|
|
|
s := f(1) + f(2)
|
2009-12-03 00:54:51 -07:00
|
|
|
if s != "aAbB" {
|
2010-03-30 11:34:57 -06:00
|
|
|
println("BUG: bug221a: ", s)
|
|
|
|
panic("fail")
|
2009-12-03 00:54:51 -07:00
|
|
|
}
|
2010-03-30 11:34:57 -06:00
|
|
|
s = g(f(3), f(4))
|
2009-12-03 00:54:51 -07:00
|
|
|
if s != "cCdD" {
|
2010-03-30 11:34:57 -06:00
|
|
|
println("BUG: bug221b: ", s)
|
|
|
|
panic("fail")
|
2009-12-03 00:54:51 -07:00
|
|
|
}
|
2010-03-30 11:34:57 -06:00
|
|
|
s = f(5) + f(6) + f(7) + f(8) + f(9)
|
2009-12-03 00:54:51 -07:00
|
|
|
if s != "eEfFgGhHiI" {
|
2010-03-30 11:34:57 -06:00
|
|
|
println("BUG: bug221c: ", s)
|
|
|
|
panic("fail")
|
2009-12-03 00:54:51 -07:00
|
|
|
}
|
|
|
|
}
|