| author | |
| committer | |
| log | f296eec294f7263c9e809c1d825a13a395e5234b |
| tree | 4792ef88c11da542cfa06163ae62bcbcf25623bc |
| parent | eee752ea5a966aafa2c22c4c4ae2ed2c741b1bab |
Resolves: #198882 files changed, 17 insertions(+), 0 deletions(-)
src/Zcu/PerThread.zig+2| ... | ... | @@ -1444,6 +1444,8 @@ fn analyzeNavType(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileEr |
| 1444 | 1444 | break :ty .fromInterned(type_ref.toInterned().?); |
| 1445 | 1445 | }; |
| 1446 | 1446 | |
| 1447 | try resolved_ty.resolveLayout(pt); | |
| 1448 | ||
| 1447 | 1449 | // In the case where the type is specified, this function is also responsible for resolving |
| 1448 | 1450 | // the pointer modifiers, i.e. alignment, linksection, addrspace. |
| 1449 | 1451 | const modifiers = try sema.resolveNavPtrModifiers(&block, zir_decl, inst_resolved.inst, resolved_ty); |
test/behavior/generics.zig+15| ... | ... | @@ -631,3 +631,18 @@ test "instantiate coerced generic function" { |
| 631 | 631 | var x: u8 = 20; |
| 632 | 632 | try coerced(u8, &x); |
| 633 | 633 | } |
| 634 | ||
| 635 | test "generic struct captures slice of another struct" { | |
| 636 | const S = struct { | |
| 637 | const Foo = struct { x: u32 }; | |
| 638 | const foo_array: [2]Foo = undefined; | |
| 639 | ||
| 640 | fn Bar(foo_slice: []const Foo) type { | |
| 641 | return struct { | |
| 642 | const foo_ptr: [*]const Foo = foo_slice.ptr; | |
| 643 | }; | |
| 644 | } | |
| 645 | }; | |
| 646 | const T = S.Bar(&S.foo_array); | |
| 647 | comptime std.debug.assert(T.foo_ptr == &S.foo_array); | |
| 648 | } |