Zcu: don't tell linkers about exports if there are compile errors

In the best case, this is redundant work, because we aren't actually
going to emit a working binary this update. In the worst case, it causes
bugs because the linker may not have *seen* the thing being exported due
to the compile errors.

Resolves: #24417
This commit is contained in:
mlugg
2025-08-15 11:18:45 +01:00
committed by Matthew Lugg
parent ce2c9399dd
commit 8adabaa4ed
3 changed files with 28 additions and 12 deletions

View File

@@ -0,0 +1,13 @@
export fn foo() void {
const S = struct { x: u32 = "bad default" };
const s: S = undefined;
_ = s;
}
// This test case explicitly runs on the LLVM backend as well as self-hosted, as
// the original bug leading to this test occurred only with the LLVM backend.
// error
// backend=stage2,llvm
//
// :2:33: error: expected type 'u32', found '*const [11:0]u8'