Debian Codegraph @

test/fixedbugs/bug293.go

raw
1 // run
2
3 // Copyright 2010 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 // https://golang.org/issue/846
8
9 package main
10
11 func x() (a int, b bool) {
12 defer func(){
13 a++
14 }()
15 a, b = y()
16 return
17 }
18
19 func x2() (a int, b bool) {
20 defer func(){
21 a++
22 }()
23 return y()
24 }
25
26 func y() (int, bool) {
27 return 4, false
28 }
29
30 func main() {
31 if a, _ := x(); a != 5 {
32 println("BUG", a)
33 }
34 if a, _ := x2(); a != 5 {
35 println("BUG", a)
36 }
37 }