translate-c fails silently when source code initializes a struct to zero #3752
Labels
contributor friendly
This issue is limited in scope and/or knowledge of Zig internals.
frontend
Tokenization, parsing, AstGen, Sema, and Liveness.
translate-c
C to Zig source translation feature (@cImport)
Milestone
If you have a C function that initializes a struct instance to
{ 0 }
and runtranslate-c
on it, then zig skips codegen for that function, and doesn't output any error messages.This was confusing to me because the function didn't output at all. I only figured it out when I did a "binary chop" on the input file to figure out which particular line was keeping the function from being output.
Ideally this would just work, but if it fails to work it would be nice if a good error message was output.
Repro steps:
main.c
:zig translate-c main.c > main.zig
SomeStruct blah;
toSomeStruct blah = { 0 };
insidemain.c
and save itzig translate-c main.c > main.zig
Expected:
The implementation of
fn main()
exists inmain.zig
after both step 2 and step 4or
An error message is displayed after step 4 that says translate-c cannot cope
Actual:
The implementation of
fn main()
exists inmain.zig
after step 2, but disappears after step 4. No error message is displayed.The text was updated successfully, but these errors were encountered: