| author | |
| committer | |
| log | 6ac462b08827a70a6bc2c1c695372a2f34075234 |
| tree | 8b9b7d7d4bab04dd6af097fa4154c39bee64dcac |
| parent | 9025f73733211b7748e64ce99368503618fc164c |
| signature |
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,6 +1444,8 @@ fn analyzeNavType(pt: Zcu.PerThread, nav_id: InternPool.Nav.Index) Zcu.CompileEr |
| 1444 | break :ty .fromInterned(type_ref.toInterned().?); | 1444 | break :ty .fromInterned(type_ref.toInterned().?); |
| 1445 | }; | 1445 | }; |
| 1446 | 1446 | ||
| 1447 | try resolved_ty.resolveLayout(pt); | ||
| 1448 | |||
| 1447 | // In the case where the type is specified, this function is also responsible for resolving | 1449 | // In the case where the type is specified, this function is also responsible for resolving |
| 1448 | // the pointer modifiers, i.e. alignment, linksection, addrspace. | 1450 | // the pointer modifiers, i.e. alignment, linksection, addrspace. |
| 1449 | const modifiers = try sema.resolveNavPtrModifiers(&block, zir_decl, inst_resolved.inst, resolved_ty); | 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,3 +631,18 @@ test "instantiate coerced generic function" { |
| 631 | var x: u8 = 20; | 631 | var x: u8 = 20; |
| 632 | try coerced(u8, &x); | 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 | } |