Source file
test/abi/result_regalloc.go
1
2
3
4
5
6
7
8
9
10 package main
11
12 type bb struct {
13 r float64
14 x []float64
15 }
16
17
18 func B(r float64, x []float64) I {
19 return bb{r, x}
20 }
21
22 func (b bb) d() (int, int) {
23 if b.r == 0 {
24 return 0, len(b.x)
25 }
26 return len(b.x), len(b.x)
27 }
28
29 type I interface { d() (int, int) }
30
31 func D(r I) (int, int) { return r.d() }
32
33
34 func F() (int, int) {
35 r := float64(1)
36 x := []float64{0, 1, 2}
37 b := B(r, x)
38 return D(b)
39 }
40
41 func main() {
42 x, y := F()
43 if x != 3 || y != 3 {
44 panic("FAIL")
45 }
46 }
47
View as plain text