authorgravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-10 22:57:13-07:00
committergravatar for andrew@ziglang.orgAndrew Kelley <andrew@ziglang.org> 2022-03-10 22:57:13-07:00
logb28b3f6f7b1dd4c3c8a0f3d3a6305a84daed8ead
treeafc3f34fa941cf26b8934bbcbdc64fdcf5bbc0e6
parent273da9efd9238e20da1299789537b00de2f0ebd8

stage2: fix comptime element load of undef array


1 files changed, 2 insertions(+), 0 deletions(-)

src/value.zig+2
...@@ -2336,6 +2336,8 @@ pub const Value = extern union {...@@ -2336,6 +2336,8 @@ pub const Value = extern union {
2336 buffer: *ElemValueBuffer,2336 buffer: *ElemValueBuffer,
2337 ) error{OutOfMemory}!Value {2337 ) error{OutOfMemory}!Value {
2338 switch (val.tag()) {2338 switch (val.tag()) {
2339 // This is the case of accessing an element of an undef array.
2340 .undef => return Value.undef,
2339 .empty_array => unreachable, // out of bounds array index2341 .empty_array => unreachable, // out of bounds array index
2340 .empty_struct_value => unreachable, // out of bounds array index2342 .empty_struct_value => unreachable, // out of bounds array index
23412343