| 1 |
// Copyright 2020 The Go Authors. All rights reserved. |
| 2 |
// Use of this source code is governed by a BSD-style |
| 3 |
// license that can be found in the LICENSE file. |
| 4 |
|
| 5 |
// Test that a live type's method is not live even if |
| 6 |
// it matches an interface method, as long as the interface |
| 7 |
// method is not used. |
| 8 |
|
| 9 |
package main |
| 10 |
|
| 11 |
type T int |
| 12 |
|
| 13 |
//go:noinline |
| 14 |
func (T) M() {} |
| 15 |
|
| 16 |
type I interface{ M() } |
| 17 |
|
| 18 |
var p *T |
| 19 |
var pp *I |
| 20 |
|
| 21 |
func main() { |
| 22 |
p = new(T) // use type T |
| 23 |
pp = new(I) // use type I |
| 24 |
*pp = *p // convert T to I, build itab |
| 25 |
} |