The codegen uses ref-union-di. A top-level union is the easy case, but this PR also supports the valid C11 case where a struct contains an anonymous union, such as cbindgen generates for its tagged unions. In this case I generate a fictitious field in the struct called union whose type is a ref-union-di Union. This should be ABI-compatible with the anonymous union, I think. Fingers crossed!
The codegen uses ref-union-di. A top-level union is the easy case, but this PR also supports the valid C11 case where a struct contains an anonymous union, such as cbindgen generates for its tagged unions. In this case I generate a fictitious field in the struct called
union
whose type is a ref-union-diUnion
. This should be ABI-compatible with the anonymous union, I think. Fingers crossed!Example input:
This generates: