-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
@intFromPtr
at comptime
has misleading error message
#22177
Comments
@intFromPtr
at comptime
error incorrectly points at argument@intFromPtr
at comptime
, error note incorrectly points at argument
There is: its address isn't known until runtime. This is different to a pointer which comes from However, I agree that this error message could be improved, so will leave this issue open. |
@intFromPtr
at comptime
, error note incorrectly points at argument@intFromPtr
at comptime
has misleading error message
That might be true in a general case, which is probably how it's currently analyzed. EDIT2: Wait, I think I see what you mean, EDIT3: For what it's worth, when replacing
You're right, I must have made a mistake when testing that before, |
Bit of a tangent, but thinking about this some more, the language actually already provides If I remember correctly last the big changes regarding comptime references were #19414 and #19630, however I couldn't find discussion about removing this behavior. |
Zig Version
0.14.0-dev.2371+c013f45ad
Steps to Reproduce and Observed Output
Current reproduction:
Current compile error output:
The note is somewhat misleading, because nothing about this operand is runtime.
It seems to me like the error note logic was copied from some other operation without much thought.
What's actually happening is that
@intFromPtr
itself is currently restricted to runtime contexts.(See #15080, the plan is to eventually implement workaround semantics for
comptime
.)Expected Output
Something along the lines of:
The text was updated successfully, but these errors were encountered: