diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-12-02 18:51:26 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-12-03 00:09:23 +0200 |
| commit | 7f9e841f746bb3eaf6ac205092a30bc7ed12a068 (patch) | |
| tree | 14b168089558d7c1c27a0ea2f6f69b8d1fbc1813 /test/behavior/struct.zig | |
| parent | 59dad43de26a89ca72a97224a171d724dcc6ee41 (diff) | |
| download | zig-7f9e841f746bb3eaf6ac205092a30bc7ed12a068.tar.gz zig-7f9e841f746bb3eaf6ac205092a30bc7ed12a068.zip | |
Sema: do not forcibly canonicalize unresolved pointer element type
Closes #13308
Diffstat (limited to 'test/behavior/struct.zig')
| -rw-r--r-- | test/behavior/struct.zig | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/test/behavior/struct.zig b/test/behavior/struct.zig index a74b9fdd53..1807b7a447 100644 --- a/test/behavior/struct.zig +++ b/test/behavior/struct.zig @@ -1406,3 +1406,15 @@ test "address of zero-bit field is equal to address of only field" { try std.testing.expectEqual(&a, a_ptr); } } + +test "struct field has a pointer to an aligned version of itself" { + if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO + + const E = struct { + next: *align(1) @This(), + }; + var e: E = undefined; + e = .{ .next = &e }; + + try expect(&e == e.next); +} |
