1 // Copyright 2021 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 // indirection
8
9 func _[P any](p P) {
10 _ = *p // ERROR cannot indirect p
11 }
12
13 func _[P interface{ int }](p P) {
14 _ = *p // ERROR cannot indirect p
15 }
16
17 func _[P interface{ *int }](p P) {
18 _ = *p
19 }
20
21 func _[P interface{ *int | *string }](p P) {
22 _ = *p // ERROR must have identical base types
23 }
24
25 type intPtr *int
26
27 func _[P interface{ *int | intPtr } ](p P) {
28 var _ int = *p
29 }
30
View as plain text