aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2019-08-30 14:53:44 -0400
committerAndrew Kelley <andrew@ziglang.org>2019-08-30 14:53:44 -0400
commitd9fed5cdfdfa6ac944856cd360d3385296f136e8 (patch)
tree6c57968453032c3e3cb8605bf925533bddd94705 /test
parent966670645a382e6c660b4a002e5eb1264a00cbe5 (diff)
downloadzig-d9fed5cdfdfa6ac944856cd360d3385296f136e8.tar.gz
zig-d9fed5cdfdfa6ac944856cd360d3385296f136e8.zip
align(@alignOf(T)) T does not force resolution of T
Diffstat (limited to 'test')
-rw-r--r--test/stage1/behavior/align.zig25
1 files changed, 24 insertions, 1 deletions
diff --git a/test/stage1/behavior/align.zig b/test/stage1/behavior/align.zig
index 677ae85b68..266e5d3519 100644
--- a/test/stage1/behavior/align.zig
+++ b/test/stage1/behavior/align.zig
@@ -1,4 +1,5 @@
-const expect = @import("std").testing.expect;
+const std = @import("std");
+const expect = std.testing.expect;
const builtin = @import("builtin");
var foo: u8 align(4) = 100;
@@ -305,3 +306,25 @@ test "struct field explicit alignment" {
comptime expect(@typeOf(&node.massive_byte) == *align(64) u8);
expect(@ptrToInt(&node.massive_byte) % 64 == 0);
}
+
+test "align(@alignOf(T)) T does not force resolution of T" {
+ const S = struct {
+ const A = struct {
+ a: *align(@alignOf(A)) A,
+ };
+ fn doTheTest() void {
+ suspend {
+ resume @frame();
+ }
+ _ = bar(@Frame(doTheTest));
+ }
+ fn bar(comptime T: type) *align(@alignOf(T)) T {
+ ok = true;
+ return undefined;
+ }
+
+ var ok = false;
+ };
+ _ = async S.doTheTest();
+ expect(S.ok);
+}