| 1 |
// run |
| 2 |
|
| 3 |
// Copyright 2018 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 |
// Issue 28390/28430: Function call arguments were not |
| 8 |
// converted correctly under some circumstances. |
| 9 |
|
| 10 |
package main |
| 11 |
|
| 12 |
import "fmt" |
| 13 |
|
| 14 |
type A struct { |
| 15 |
K int |
| 16 |
S string |
| 17 |
M map[string]string |
| 18 |
} |
| 19 |
|
| 20 |
func newA(k int, s string) (a A) { |
| 21 |
a.K = k |
| 22 |
a.S = s |
| 23 |
a.M = make(map[string]string) |
| 24 |
a.M[s] = s |
| 25 |
return |
| 26 |
} |
| 27 |
|
| 28 |
func proxy() (x int, a A) { |
| 29 |
return 1, newA(2, "3") |
| 30 |
} |
| 31 |
|
| 32 |
func consume(x int, a interface{}) { |
| 33 |
fmt.Println(x) |
| 34 |
fmt.Println(a) // used to panic here |
| 35 |
} |
| 36 |
|
| 37 |
func main() { |
| 38 |
consume(proxy()) |
| 39 |
} |