Issue with assert in file generated by translate-c (regression - zig 0.17+870-ish)

I started having this issue while building SDL3 for dvui :

.zig-cache/o/5a5aeab7c329fb1a07420d083f7f609d/sdl3-c.zig:3857:49: error: null pointer casted to type '*sdl3-c.union_SDL_Event'
    if (!(@sizeOf(SDL_Event) == @sizeOf(@TypeOf(@as([*c]SDL_Event, null).*.padding)))) @compileError("static assertion failed \"sizeof(SDL_Event) == sizeof((SDL_
static_cast(SDL_Event *, NULL))->padding)\"");

This check seems to be a direct translation of this line :

I’m not sure what is the exact commit introducing this but it was still working fine with 0.17.0-dev.864+3deb86baf and started to show up for me in 0.17.0-dev.889+e6be5cfe3

Note that it seems the check was already translated with the working (dev.864) compiler but the compileError was not triggered.

Anybody familiar with this stuff ?

this was a temporary regression and has been fixed on master:
https://codeberg.org/ziglang/zig/pulls/35851

2 Likes

Wonderful. Thanks. Bad timing on my side. Should have waited a couple of extra days :laughing:

1 Like