I get error code 5 with this code, why does this happen?
const std = @import("std");
fn ComptimeStack(comptime T: type) type {
return struct {
array: []T,
pub inline fn init() @This() {
return .{ .array = &.{} };
}
pub inline fn push(comptime self: *@This(), item: T) !void {
var a = (self.array ++ .{item}).*;
self.array = &a;
}
};
}
pub fn main() void {
comptime var stack = ComptimeStack(struct { u32, ?struct { val: u8 } }).init();
comptime try stack.push(.{420, null});
std.mem.doNotOptimizeAway(stack);
}