2012-02-18 14:15:42 -07:00
|
|
|
// run
|
2012-01-23 08:56:57 -07:00
|
|
|
|
2016-04-10 15:32:26 -06:00
|
|
|
// Copyright 2011 The Go Authors. All rights reserved.
|
2012-01-23 08:56:57 -07:00
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
|
|
|
// Issue 2582
|
2012-01-25 15:53:50 -07:00
|
|
|
package main
|
|
|
|
|
|
|
|
type T struct{}
|
|
|
|
|
2015-10-29 20:45:19 -06:00
|
|
|
//go:noinline
|
2012-01-23 08:56:57 -07:00
|
|
|
func (T) cplx() complex128 {
|
2012-01-25 15:53:50 -07:00
|
|
|
return complex(1, 0)
|
|
|
|
}
|
|
|
|
|
|
|
|
func (T) cplx2() complex128 {
|
|
|
|
return complex(0, 1)
|
2012-01-23 08:56:57 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
type I interface {
|
|
|
|
cplx() complex128
|
|
|
|
}
|
|
|
|
|
2012-01-25 15:53:50 -07:00
|
|
|
func main() {
|
2012-01-23 08:56:57 -07:00
|
|
|
|
2012-01-25 15:53:50 -07:00
|
|
|
var t T
|
|
|
|
|
|
|
|
if v := real(t.cplx()); v != 1 {
|
|
|
|
panic("not-inlined complex call failed")
|
|
|
|
}
|
|
|
|
_ = imag(t.cplx())
|
|
|
|
|
|
|
|
_ = real(t.cplx2())
|
|
|
|
if v := imag(t.cplx2()); v != 1 {
|
|
|
|
panic("potentially inlined complex call failed")
|
|
|
|
}
|
2012-01-23 08:56:57 -07:00
|
|
|
|
|
|
|
var i I
|
|
|
|
i = t
|
2012-01-25 15:53:50 -07:00
|
|
|
if v := real(i.cplx()); v != 1 {
|
|
|
|
panic("potentially inlined complex call failed")
|
|
|
|
}
|
|
|
|
_ = imag(i.cplx())
|
|
|
|
}
|