mirror of
https://github.com/ziglang/zig.git
synced 2026-02-12 20:37:54 +00:00
parent
e60db701d1
commit
6f5a438946
@ -5070,6 +5070,7 @@ fn containerDecl(
|
||||
try astgen.extra.ensureUnusedCapacity(gpa, decls_slice.len);
|
||||
astgen.extra.appendSliceAssumeCapacity(decls_slice);
|
||||
|
||||
block_scope.unstack();
|
||||
try gz.addNamespaceCaptures(&namespace);
|
||||
return rvalue(gz, ri, indexToRef(decl_inst), node);
|
||||
},
|
||||
|
||||
@ -1127,3 +1127,14 @@ test "pointer to zero sized global is mutable" {
|
||||
};
|
||||
try expect(@TypeOf(&S.thing) == *S.Thing);
|
||||
}
|
||||
|
||||
test "returning an opaque type from a function" {
|
||||
const S = struct {
|
||||
fn foo(comptime a: u32) type {
|
||||
return opaque {
|
||||
const b = a;
|
||||
};
|
||||
}
|
||||
};
|
||||
try expect(S.foo(123).b == 123);
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user