-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.translate-cC to Zig source translation feature (@cImport)C to Zig source translation feature (@cImport)
Milestone
Description
I ran across this while trying to use the Nuklear library. The nk_utf_decode_byte
function is incorrectly translated and creates a syntax error.
Here is a minimal reproducible example:
void foo(void) {
int i = 0;
int *x = &i;
for (i = 0; i < 3; (i) += 1) {}
for (*x = 0; *x < 3; ++(*x)) {}
for (*x = 0; *x < 3; (*x) += 1) {}
}
which translate-c
translates to
pub export fn foo() void {
var i: c_int = 0;
var x: [*c]c_int = &i;
{
i = 0;
while (i < @as(c_int, 3)) ( i(i) += @as(c_int, 1)) {}
}
{
x.?.* = 0;
while (x.?.* < @as(c_int, 3)) ? .*(x.?.*) += 1) {}
}
{
x.?.* = 0;
while (x.?.* < @as(c_int, 3)) ? .*(x.?.*) += @as(c_int, 1)) {}
}
return 0;
}
I tested using versions 0.7.1
and 0.8.0-dev.1060+1ed8c54cd
.
Metadata
Metadata
Assignees
Labels
bugObserved behavior contradicts documented or intended behaviorObserved behavior contradicts documented or intended behaviorfrontendTokenization, parsing, AstGen, Sema, and Liveness.Tokenization, parsing, AstGen, Sema, and Liveness.translate-cC to Zig source translation feature (@cImport)C to Zig source translation feature (@cImport)