On Thu, Feb 16, 2023 at 2:38 AM Jan <pfei...@gmail.com> 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. > struct SomeType; > typedef struct SomeType SomeType; > > // Fully defined type. > typedef struct { > char C; > } FullyDefinedType; > */ > import "C" > import ( > "fmt" > ) > > type Wrapper[T any] struct { > P *T > } > > type SomeTypeHolder struct { > *Wrapper[C.SomeType] > } > > type FullyDefinedTypeHolder struct { > *Wrapper[C.FullyDefinedType] > } > > func main() { > //var p *C.SomeType > var x SomeTypeHolder > var y FullyDefinedTypeHolder > fmt.Printf("x.Wrapper=%x\n", x.Wrapper) > fmt.Printf("y.Wrapper=%x\n", y.Wrapper) > } > ``` > > In go 1.19.5 it prints: > > $ go run . > x.Wrapper=0 > y.Wrapper=0 > > In go 1.20 it prints: > > $ go run . > # ... > ./main.go:22:3: cannot use incomplete (or unallocatable) type as a type > argument: main._Ctype_struct_SomeType
Giving an error here is https://go.dev/issue/54765. That is, fixing that issue in 1.20 is what causes this program to not compile. Ian -- 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/CAOyqgcWf3H-TAQU-cW_ku-jah53-SUKfbEpLtGydpcP3FxMtrQ%40mail.gmail.com.