A slightly simpler case causes translate-c itself to error:
typedef struct
{
int x;
} MyCStruct;
#define A (MyCStruct) { .x = (0) }
Results in:
./zig-cache/o/ab465fa0d3d09e55c37d8a6119380a06/cimport.zig:17:15: error: unable to translate C expr: unexpected token .Period
pub const A = @compileError("unable to translate C expr: unexpected token .Period");
Importing the following C header causes incorrect Zig code to be generated:
Results in:
A slightly simpler case causes translate-c itself to error:
Results in:
In general it seems to be the use of struct initialization syntax in a macro giving incorrect results. I encountered this when trying to include the GTK4 header: https://zigforum.org/t/compile-error-in-cimport-code-with-gtk4/499