Sema: disallow @intFromPtr for comptime-only types

This commit is contained in:
Bogdan Romanyuk
2023-10-17 23:05:55 +03:00
committed by GitHub
parent 5c8912d7a4
commit ad168db727
3 changed files with 22 additions and 16 deletions

View File

@@ -499,22 +499,6 @@ test "ptrCast comptime known slice to C pointer" {
try std.testing.expectEqualStrings(s, std.mem.sliceTo(p, 0));
}
test "intFromPtr on a generic function" {
if (builtin.zig_backend == .stage2_wasm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_arm) return error.SkipZigTest; // TODO
if (builtin.zig_backend == .stage2_aarch64) return error.SkipZigTest; // TODO
const S = struct {
fn generic(i: anytype) @TypeOf(i) {
return i;
}
fn doTheTest(a: anytype) !void {
try expect(@intFromPtr(a) != 0);
}
};
try S.doTheTest(&S.generic);
}
test "pointer alignment and element type include call expression" {
const S = struct {
fn T() type {