Open devraymondsh opened 3 months ago
Reproduce this problem by translating C with zig translate-c -lc macro_fn_arr_ty.c > macro_fn_arr_ty.zig
.
macro_fn_arr_ty.c
:
#define G(T) T
#define F G(unsigned char[1])
Append boilerplate:
export fn entry() void {
_ = &F;
}
Compile example program with zig build-obj macro_fn_arr_ty.zig
.
Will face this error:
macro_fn_arr_ty.zig:498:19: error: type 'type' does not support indexing
pub const F = G(u8[@as(usize, @intCast(@as(c_int, 1)))]);
~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
macro_fn_arr_ty.zig:498:19: note: operand must be an array, slice, tuple, or vector
referenced by:
entry: macro_fn_arr_ty.zig:500:10
entry: macro_fn_arr_ty.zig:499:1
4 reference(s) hidden; use '-freference-trace=6' to see all references
Zig Version
0.14.0-dev.1294+df6907f60
Steps to Reproduce and Observed Behavior
I was trying to translate the io_uring.h file from Linux's uapi using Zig's translate-c. The header is dependent on ioctl.h and fscrypt.h. Here's the Zig translation:
I get this error:
It's basically translating this line but generates
__u8[16]
instead of[16]__u8
which is the correct Zig equivalent.Expected Behavior
Should have become
[16]__u8
which is the correct translation.