| 1 |
// Copyright 2025 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 |
package p |
| 6 |
|
| 7 |
import "unsafe" |
| 8 |
|
| 9 |
type A /* ERROR "invalid recursive type" */ [unsafe.Sizeof(B{})]int |
| 10 |
type B A |
| 11 |
|
| 12 |
type C /* ERROR "invalid recursive type" */ [unsafe.Sizeof(f())]int |
| 13 |
func f() D { |
| 14 |
return D{} |
| 15 |
} |
| 16 |
type D C |
| 17 |
|
| 18 |
type E /* ERROR "invalid recursive type" */ [unsafe.Sizeof(g[F]())]int |
| 19 |
func g[P any]() P { |
| 20 |
panic(0) |
| 21 |
} |
| 22 |
type F struct { |
| 23 |
f E |
| 24 |
} |
| 25 |
|