Skip to content
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

unable to compare pointers: '?*T' and '*const T' #1298

Closed
BarabasGitHub opened this Issue Jul 27, 2018 · 2 comments

Comments

Projects
None yet
3 participants
@BarabasGitHub
Copy link
Contributor

BarabasGitHub commented Jul 27, 2018

I was surprised that this didn't compile:

const a: * const usize = @intToPtr(*const usize, 0x123456789);
const b: ?*usize = @intToPtr(* usize, 0x123456789);
std.debug.assert(a == b);

I expected it to know how to compare these two pointer.

@BarabasGitHub BarabasGitHub changed the title incompatible types: '?*T' and '*const T' unable to compare pointers: '?*T' and '*const T' Jul 27, 2018

@thejoshwolfe

This comment has been minimized.

Copy link
Member

thejoshwolfe commented Jul 27, 2018

you can't implicitly remove const. try

b: ?* const usize = a;
@BarabasGitHub

This comment has been minimized.

Copy link
Contributor Author

BarabasGitHub commented Jul 27, 2018

Oh I see. I didn't make the right example. I fixed it.

@andrewrk andrewrk added this to the 0.4.0 milestone Jul 30, 2018

@andrewrk andrewrk closed this in 4d50bc3 Mar 23, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.