test/fixedbugs/issue52072.go
raw| 1 | // run |
| 2 | |
| 3 | // Copyright 2022 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 | package main |
| 8 | |
| 9 | type I interface{ M() } |
| 10 | |
| 11 | type T struct { |
| 12 | x int |
| 13 | } |
| 14 | |
| 15 | func (T) M() {} |
| 16 | |
| 17 | var pt *T |
| 18 | |
| 19 | func f() (r int) { |
| 20 | defer func() { recover() }() |
| 21 | |
| 22 | var i I = pt |
| 23 | defer i.M() |
| 24 | r = 1 |
| 25 | return |
| 26 | } |
| 27 | |
| 28 | func main() { |
| 29 | if got := f(); got != 1 { |
| 30 | panic(got) |
| 31 | } |
| 32 | } |