Merge pull request #23263 from mlugg/comptime-field-ptr

Sema: fix pointers to comptime fields of comptime-known aggregate pointers
This commit is contained in:
Matthew Lugg
2025-05-03 20:10:42 +01:00
committed by GitHub
4 changed files with 79 additions and 33 deletions

View File

@@ -0,0 +1,19 @@
const init: u32 = 1;
fn rt() u32 {
return 3;
}
var tuple_val = .{init};
export fn tuple_field() void {
tuple_val[0] = rt();
}
var struct_val = .{ .x = init };
export fn struct_field() void {
struct_val.x = rt();
}
// error
//
// :8:14: error: cannot store runtime value in compile time variable
// :13:15: error: cannot store runtime value in compile time variable