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

THanks!
On Thursday, February 16, 2023 at 9:35:09 AM UTC+1 Jan Mercl wrote:

> On Thu, Feb 16, 2023 at 8:22 AM Jan <pfe...@gmail.com> 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 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/0375b4c1-9551-4d87-85ef-1ff48cf66236n%40googlegroups.com.

Reply via email to