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 unallocatable) type as a type argument: ...` for 
all my C structures.

I went back to go 1.19.5 and things work just fine again.

Any thoughts ?

Maybe it's deliberate (but it seems to break compatibility) ? I saw the 
release note:

*"Go 1.20 adds new Incomplete 
<https://tip.golang.org/pkg/runtime/cgo/#Incomplete> marker type. Code 
generated by cgo will use cgo.Incomplete to mark an incomplete C type."*

But I'm not sure what that entails to my particular code.

Maybe I should use as type parameter the pointer to the C structure and 
write instead:

```
type Wrapper[T any] struct {
P T
destructor func(p T)
}
```
Any suggestions ?

cheers

-- 
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/2f0f5c87-4731-4866-bf3b-4de55b496d57n%40googlegroups.com.

Reply via email to