i am a fresh new in zig who test a few codes with "orelse"
i tried to create 2 optional unsigned integer varibles as following code and use orelse with them
const std = @import("std");
pub fn main() !void {
var value1: ?u32 = 123;
var value2: ?u32 = 222;
std.debug.print("value1 orelse value2: {}\n", .{value1 orelse value2});
}
my expection, it should print 123, but i got an runtime error (or at least i understand it is);
zig run main.zig
broken LLVM module found: Instruction does not dominate all uses!
%7 = getelementptr inbounds %"struct:26:52", %"struct:26:52"* %1, i32 0, i32 0, !dbg !2021
%12 = getelementptr inbounds %"?u32", %"?u32"* %7, i32 0, i32 1, !dbg !2020
Instruction does not dominate all uses!
%7 = getelementptr inbounds %"struct:26:52", %"struct:26:52"* %1, i32 0, i32 0, !dbg !2021
%13 = getelementptr inbounds %"?u32", %"?u32"* %7, i32 0, i32 0, !dbg !2020
This is a bug in the Zig compiler.thread 1856201 panic:
Unable to dump stack trace: debug info stripped
make: *** [run] Abort trap: 6
so is it the correct expectation, or it is a bug, where where should I post it (sorry I'm a newbie).
I'm using zig 0.9.1. Run on MacOS 12.5 (21G72), Thanks for your taking time
标签:26,struct,i32,dbg,u32,bug,orelse From: https://www.cnblogs.com/zhengel/p/16750863.html