From a0914e92fc2d1b54d742b5ae02f20530581d88c1 Mon Sep 17 00:00:00 2001 From: travisstaloch <1562827+travisstaloch@users.noreply.github.com> Date: Fri, 12 Apr 2024 03:10:42 -0700 Subject: [PATCH] translate-c: allow str literals in bool expressions this is a follow up to #19610 with fix suggested by Vexu in https://github.com/ziglang/zig/issues/14642#issuecomment-2048999384 --- translate_c/strlit_as_bool.c | 8 ++++++++ 1 file changed, 8 insertions(+) create mode 100644 translate_c/strlit_as_bool.c diff --git a/translate_c/strlit_as_bool.c b/translate_c/strlit_as_bool.c new file mode 100644 index 000000000000..4ba0cfe2a4b2 --- /dev/null +++ b/translate_c/strlit_as_bool.c @@ -0,0 +1,8 @@ +void foo() { if(0 && "error message") {} } + +// translate-c +// c_frontend=clang +// +// pub export fn foo() void { +// if (false and (@intFromPtr("error message") != 0)) {} +// }