mirror of
https://github.com/ziglang/zig.git
synced 2024-11-15 00:26:57 +00:00
parent
0e6c18c820
commit
eafb8e8572
@ -1184,7 +1184,7 @@ ZigType *get_fn_type(CodeGen *g, FnTypeId *fn_type_id) {
|
||||
gen_param_info->src_index = i;
|
||||
gen_param_info->gen_index = SIZE_MAX;
|
||||
|
||||
if ((err = ensure_complete_type(g, type_entry)))
|
||||
if ((err = type_resolve(g, type_entry, ResolveStatusZeroBitsKnown)))
|
||||
return g->builtin_types.entry_invalid;
|
||||
|
||||
if (is_c_abi)
|
||||
|
@ -699,3 +699,18 @@ test "equality compare fn ptrs" {
|
||||
var a = emptyFn;
|
||||
assert(a == a);
|
||||
}
|
||||
|
||||
test "self reference through fn ptr field" {
|
||||
const S = struct {
|
||||
const A = struct {
|
||||
f: fn (A) u8,
|
||||
};
|
||||
|
||||
fn foo(a: A) u8 {
|
||||
return 12;
|
||||
}
|
||||
};
|
||||
var a: S.A = undefined;
|
||||
a.f = S.foo;
|
||||
assert(a.f(a) == 12);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user