diff --git a/src/ir.cpp b/src/ir.cpp index 0dd8f4e86a3761132a79057a8fe3fd035dd77c38..e162125fb47913292fa68263ee654733845e428a 100644 --- a/src/ir.cpp +++ b/src/ir.cpp @@ -20317,7 +20317,7 @@ static IrInstGen *ir_analyze_fn_call(IrAnalyze *ira, IrInst* source_instr, } IrInstGen *first_arg; - if (!first_arg_known_bare && handle_is_ptr(ira->codegen, first_arg_ptr->value->type->data.pointer.child_type)) { + if (!first_arg_known_bare) { first_arg = first_arg_ptr; } else { first_arg = ir_get_deref(ira, &first_arg_ptr->base, first_arg_ptr, nullptr); diff --git a/test/stage1/behavior/enum.zig b/test/stage1/behavior/enum.zig index b9bb1db5332fc8c73a3607c1ae7cf3ffd49b831e..f569264520594de12757acd4f86520ebcaf0eae9 100644 --- a/test/stage1/behavior/enum.zig +++ b/test/stage1/behavior/enum.zig @@ -1150,10 +1150,15 @@ test "method call on an enum" { fn method(self: *E) bool { return self.* == .two; } + + fn generic_method(self: *E, foo: anytype) bool { + return self.* == .two and foo == bool; + } }; fn doTheTest() void { var e = E.two; expect(e.method()); + expect(e.generic_method(bool)); } }; S.doTheTest();