test/fixedbugs/issue52907.go
raw| 1 | // compile |
| 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 | func f[T int](t T) { |
| 10 | for true { |
| 11 | func() { |
| 12 | t = func() T { return t }() |
| 13 | }() |
| 14 | } |
| 15 | } |
| 16 | |
| 17 | func g[T int](g T) { |
| 18 | for true { |
| 19 | _ = func() T { return func(int) T { return g }(0) }() |
| 20 | } |
| 21 | } |
| 22 | |
| 23 | func main() { |
| 24 | f(0) |
| 25 | g(0) |
| 26 | } |