OSDN Git Service

a17453419417734b7a911449ed16bd99da52b183
[pf3gnuchains/gcc-fork.git] / gcc / testsuite / go.test / test / fixedbugs / bug364.go
1 package main
2
3 import "fmt"
4
5 var s string
6
7 func accum(args ...interface{}) {
8         s += fmt.Sprintln(args...)
9 }
10
11 func f(){
12         v := 0.0
13         for i := 0; i < 3; i++ {
14                 v += 0.1
15                 defer accum(v)
16         }
17 }
18
19 func main() {
20         f()
21         if s != "0.30000000000000004\n0.2\n0.1\n" {
22                 println("BUG: defer")
23                 print(s)
24         }
25 }