Re: [go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-16 Thread Ian Lance Taylor
On Thu, Feb 16, 2023 at 8:33 PM Jan Pfeifer wrote: > > Indeed. > > But it feels like that an incomplete type as type parameter should be ok if > we are never instantiating it, and only using pointers to it. From what I see > this was not considered in https://go.dev/issue/54765. > > Should this

Re: [go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-16 Thread Jan Pfeifer
Indeed. But it feels like that an incomplete type as type parameter should be ok if we are never instantiating it, and only using pointers to it. From what I see this was not considered in https://go.dev/issue/54765. Should this be raised as an issue for 1.21 or a 1.20.1 ? Any thoughts ? On

Re: [go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-16 Thread Ian Lance Taylor
On Thu, Feb 16, 2023 at 2:38 AM Jan wrote: > > Apologies, actually it was trickier than I thought, the issue happens in not > fully defined C types only. So here is an example that runs in go 1.19.5, but > fails in go 1.20 > > ``` > package main > > /* > // Forward reference of C++ types. >

Re: [go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-16 Thread Jan
Apologies, actually it was trickier than I thought, the issue happens in not fully defined C types only. So here is an example that runs in go 1.19.5, but fails in go 1.20 ``` package main /* // Forward reference of C++ types. struct SomeType; typedef struct SomeType SomeType; // Fully

Re: [go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-16 Thread Jan Mercl
On Thu, Feb 16, 2023 at 8:22 AM Jan wrote: > Any thoughts ? A minimal, self-contained and runnable reproducer would be rather useful in this case. -- You received this message because you are subscribed to the Google Groups "golang-nuts" group. To unsubscribe from this group and stop

[go-nuts] CGO Struct used as type parameter causes issue in Go 1.20

2023-02-15 Thread Jan
hi all, In a project that requires CGO I wrote a little generic wrapper over my C structs (mostly for debugging): ``` type Wrapper[T any] struct { P *T destructor func(p *T) } ``` And it was working fine. But with go 1.20 I started seeing errors of the type `cannot use incomplete (or