Zig Version
0.11.0-dev.2194+626a75bbc
Steps to Reproduce and Observed Behavior
When building a file containing this code...
const std = @import("std");
fn c () void {}
const b = @ptrToInt(&c);
pub fn main () void {
std.debug.print("{}", .{b});
}
... with this parameters...
... I get the following error...
f.zig:40:11: error: unable to evaluate comptime expression
const b = @ptrToInt(&c);
^~~~~~~~~~~~~
f.zig:40:21: note: operation is runtime due to this operand
const b = @ptrToInt(&c);
This does not seem right to me, since it is okay to take a function address and print in main. For some reason the compiler is unable to understand a slightly more compilcated arrangement of things. Why is that, I wonder?
Expected Behavior
Should work just fine.
Zig Version
0.11.0-dev.2194+626a75bbc
Steps to Reproduce and Observed Behavior
When building a file containing this code...
... with this parameters...
... I get the following error...
This does not seem right to me, since it is okay to take a function address and print in main. For some reason the compiler is unable to understand a slightly more compilcated arrangement of things. Why is that, I wonder?
Expected Behavior
Should work just fine.