fix: allow void (zero-sized) struct/tuple fields instead of crashing (issue 0150)

A struct/tuple/?T with a void field crashed the compiler: the field lowered to
LLVM's unsized 'void' type, which traps getTypeSizeInBits. Lower a void field to
a SIZED zero-byte [0 x i8] (fieldLLVMType) so the enclosing aggregate stays sized
with identical element indices, and skip inserting a value for a void field in
emitStructInit (the i64 placeholder would type-mismatch the [0 x i8] slot and
corrupt the aggregate constant -> runtime bus error). Future(void) now works.

Regression: examples/0190-types-void-struct-field-zero-sized.sx
This commit is contained in:
agra
2026-06-21 09:21:18 +03:00
parent 7057175fb6
commit 4fc5411cd9
8 changed files with 75 additions and 17 deletions

View File

@@ -0,0 +1 @@
0

View File

@@ -0,0 +1,3 @@
ok
tag=7
t1=9