Skip to content

Instantly share code, notes, and snippets.

@cgag
Last active September 9, 2018 23:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cgag/7a293c6a7c4bd27cef7dcfe3538b7367 to your computer and use it in GitHub Desktop.
Save cgag/7a293c6a7c4bd27cef7dcfe3538b7367 to your computer and use it in GitHub Desktop.
zig compiler assertion
const std = @import("std");
const warn = std.debug.warn;
const fmt = std.fmt;
const mem = std.mem;
var alloc = &std.heap.DirectAllocator.init().allocator;
pub const Expr = union(enum) {
Literal: Literal,
};
pub const Literal = union(enum) {
Number: f64,
Bool: bool,
};
pub fn main() !void {
const s = try fmt.allocPrint(alloc, "{}", Expr{.Literal=Literal{.Bool=true}});
warn("{}\n",s);
}
ryzen crafting-interpreters-zig/bugs [master●] » zig build-exe ./main.zig
zig: /home/cgag/bin/zig/src/codegen.cpp:4721: LLVMOpaqueValue* ir_render_union_tag(CodeGen*, IrExecutable*, IrInstructionUnionTag*): Assertion `union_type->data.unionation.gen_tag_index != SIZE_MAX' failed.
[1] 29563 abort (core dumped) zig run ./main.zig
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment