aboutsummaryrefslogtreecommitdiff
path: root/test/behavior
diff options
context:
space:
mode:
authorVeikka Tuominen <git@vexu.eu>2022-11-04 17:10:23 +0200
committerVeikka Tuominen <git@vexu.eu>2022-11-04 23:13:49 +0200
commit799a558e393d1c8286e8faec2bf8930138d8b1f4 (patch)
tree50beaa01c84a45fcf4162b80a62eaeda36cb4fe3 /test/behavior
parente6b3cb5043b189fab6417df4a6921728ea174c8f (diff)
downloadzig-799a558e393d1c8286e8faec2bf8930138d8b1f4.tar.gz
zig-799a558e393d1c8286e8faec2bf8930138d8b1f4.zip
Sema: implement peer type resolution of function pointers and function bodies
Closes #13438
Diffstat (limited to 'test/behavior')
-rw-r--r--test/behavior/cast.zig10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/behavior/cast.zig b/test/behavior/cast.zig
index 07d45ad3dc..0de4b6d53e 100644
--- a/test/behavior/cast.zig
+++ b/test/behavior/cast.zig
@@ -1419,3 +1419,13 @@ test "floatToInt to zero-bit int" {
var a: f32 = 0.0;
comptime try std.testing.expect(@floatToInt(u0, a) == 0);
}
+
+test "peer type resolution of function pointer and function body" {
+ if (builtin.zig_backend == .stage1) return error.SkipZigTest;
+
+ const T = fn () u32;
+ const a: T = undefined;
+ const b: *const T = undefined;
+ try expect(@TypeOf(a, b) == *const fn () u32);
+ try expect(@TypeOf(b, a) == *const fn () u32);
+}