@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user