Ah, I forgot that point. Thanks for the explanation! On Saturday, April 2, 2022 at 10:00:27 PM UTC+8 axel.wa...@googlemail.com wrote:
> Ptr[int] is a defined type, `*int` is not. So the two types are not the > same and this is working as intended. > > On Sat, Apr 2, 2022 at 3:50 PM tapi...@gmail.com <tapi...@gmail.com> > wrote: > >> >> package main >> >> type Ptr[E any] *E >> >> type MyConstraint interface { >> Ptr[int] >> } >> >> type YourConstraint interface { >> *int >> } >> >> func foo[T MyConstraint](x T) { >> } >> >> func bar[T YourConstraint](x T) { >> } >> >> func main() { >> var x = new(int) >> foo(x) // *int does not implement MyConstraint >> bar(x) >> } >> >> -- >> You received this message because you are subscribed to the Google Groups >> "golang-nuts" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to golang-nuts...@googlegroups.com. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/golang-nuts/e252f550-b5ae-43ca-b25d-12ce076fd74cn%40googlegroups.com >> >> <https://groups.google.com/d/msgid/golang-nuts/e252f550-b5ae-43ca-b25d-12ce076fd74cn%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> > -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/4f08c0cb-a03e-4de2-b59d-c8edffe42d52n%40googlegroups.com.