Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot specify more than a single argument in CommandDescriptor #2

Open
hazeycode opened this issue May 10, 2022 · 1 comment
Open
Labels
bug Something isn't working
Milestone

Comments

@hazeycode
Copy link
Owner

For example, trying to compile this program, where the command named "add" has 2 arguments first and second:

const clulz = @import("clulz.zig");

pub fn main() !void {
  
    while (context.quit == false) {
        _ = try clulz.promptCommand("example> ", .{}, &[_]clulz.CommandDescriptor{
            .{
                .command = "add",
                .description = "Add two numbers",
                .args = struct { first: u32, second: u32 },
                .proc = add,
            },
            .{
                .command = "quit",
                .description = "Terminate the program",
                .args = struct {},
                .proc = quit,  
            },
        });
    }
}

fn add(args: anytype, _:anytype) void {
    clulz.println("{} + {} = {}", .{args.first, args.second, args.first + args.second}) catch unreachable;
}

causes Zig to panic with the following output:

broken LLVM module found: Operand is null
br i1 %418, label %ErrRetReturn99, <null operand!>, !dbg !19334
Operand is null
br i1 %492, label %ErrRetReturn121, <null operand!>, !dbg !19334
This is a bug in the Zig compiler.thread 275681 panic:
Unable to dump stack trace: debug info stripped

@hazeycode
Copy link
Owner Author

Relates to ziglang/zig#8893

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant