zig/test/cases/inttoptr.zig
Jimmi Holst Christensen 45e72c0b39 Fixed intToPtr to fn type when the address is hardcoded (#1842)
* Fixed intToPtr to fn type

* Added test

* Import inttoptr.zig in behavior.zig
2018-12-19 09:39:18 -05:00

14 lines
353 B
Zig

const builtin = @import("builtin");
const std = @import("std");
const assertOrPanic = std.debug.assertOrPanic;
test "casting random address to function pointer" {
randomAddressToFunction();
comptime randomAddressToFunction();
}
fn randomAddressToFunction() void {
var addr: usize = 0xdeadbeef;
var ptr = @intToPtr(fn () void, addr);
}