blob: a2cde2a501ea43f3108b51f57ee3e14aa85e770b [file] [log] [blame]
Daniel Morsing2667dcd2013-03-18 22:22:35 +01001// run
2
3// Copyright 2013 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 5056: escape analysis not applied to wrapper functions
8
9package main
10
11type Foo int16
12
13func (f Foo) Esc() *int{
14 x := int(f)
15 return &x
16}
17
18type iface interface {
19 Esc() *int
20}
21
22var bar, foobar *int
23
24func main() {
25 var quux iface
26 var x Foo
27
28 quux = x
29 bar = quux.Esc()
30 foobar = quux.Esc()
31 if bar == foobar {
32 panic("bar == foobar")
33 }
34}