commit de9c889a0e7b8ef71d1c1d11985bf87e180885a6 (tree)
parent e6596cbbf077e00190af5dfb418dd9c30ebe9b6f
Author: Techatrix <techatrix@mailbox.org>
Date: Sat, 25 Jan 2025 19:32:33 +0100
aro_translate_c: fix ast lowering of continue node
fixes #22601
Diffstat:
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/lib/compiler/aro_translate_c/ast.zig b/lib/compiler/aro_translate_c/ast.zig
@@ -993,7 +993,7 @@ fn renderNode(c: *Context, node: Node) Allocator.Error!NodeIndex {
.main_token = try c.addToken(.keyword_continue, "continue"),
.data = .{
.lhs = 0,
- .rhs = undefined,
+ .rhs = 0,
},
}),
.return_void => return c.addNode(.{
diff --git a/test/cases/translate_c/continue_from_while.c b/test/cases/translate_c/continue_from_while.c
@@ -0,0 +1,14 @@
+void foo() {
+ for (;;) {
+ continue;
+ }
+}
+
+// translate-c
+// c_frontend=clang
+//
+// pub export fn foo() void {
+// while (true) {
+// continue;
+// }
+// }