zig
zig copied to clipboard
translate-c: error: use of undeclared identifier 'struct_name'
Zig Version
0.11.0-dev.85+694d8831c
Steps to Reproduce and Observed Behavior
zig translate-c fails to translate a fairly common macro found in many headers:
#define STRUCTIFY(name) struct name
$ zig translate-c test.h > test.zig && zig ast-check test.zig
test.zig:471:48: error: use of undeclared identifier 'struct_name'
pub inline fn STRUCTIFY(name: anytype) @TypeOf(struct_name) {
^~~~~~~~~~~
The translated output is the following:
pub inline fn STRUCTIFY(name: anytype) @TypeOf(struct_name) {
_ = @TypeOf(name);
return struct_name;
}
Expected Behavior
Both zig translate-c and @cInclude'ing the header should work.