diff options
| author | Veikka Tuominen <git@vexu.eu> | 2022-11-11 17:56:37 +0200 |
|---|---|---|
| committer | Veikka Tuominen <git@vexu.eu> | 2022-11-12 15:41:29 +0200 |
| commit | d42f4abb9dc906ef20b622656c7672cb7df02096 (patch) | |
| tree | fa5bc68b71fe6b180e28abe2bf31a1b44dfb63c0 /test | |
| parent | e01ec96288bd32c7ec3bba01ee200cc115cdfb1d (diff) | |
| download | zig-d42f4abb9dc906ef20b622656c7672cb7df02096.tar.gz zig-d42f4abb9dc906ef20b622656c7672cb7df02096.zip | |
llvm: correctly lower references to generic functions
Closes #13522
Diffstat (limited to 'test')
| -rw-r--r-- | test/behavior/pointers.zig | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/test/behavior/pointers.zig b/test/behavior/pointers.zig index 8ee7b5142a..43e62fdc93 100644 --- a/test/behavior/pointers.zig +++ b/test/behavior/pointers.zig @@ -489,3 +489,20 @@ test "ptrCast comptime known slice to C pointer" { var p = @ptrCast([*c]const u8, s); try std.testing.expectEqualStrings(s, std.mem.sliceTo(p, 0)); } + +test "ptrToInt on a generic function" { + if (builtin.zig_backend == .stage2_c) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_aarch64 and builtin.os.tag != .linux) return error.SkipZigTest; // TODO + if (builtin.zig_backend == .stage2_x86_64 and builtin.os.tag != .linux) return error.SkipZigTest; // TODO + + const S = struct { + fn generic(i: anytype) @TypeOf(i) { + return i; + } + fn doTheTest(a: anytype) !void { + try expect(@ptrToInt(a) != 0); + } + }; + try S.doTheTest(&S.generic); +} |
