Skip to content

Conversation

@LemonBoy
Copy link
Contributor

If both operands are pointers, and the operator is -, the pointers are subtracted and the result is divided by the size of the type pointed to by the operands. It is an error if the pointers point to different types. The type of the result is ptrdiff_t.

See DMD's PR

Copy link
Contributor

@dukc dukc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think int* and void* should cast the int* implicitly to void*, but according to that bug spec the first value is cast to type of the second, which is indeed dangerous. So yes, I think it should be forbidden as the docs say. If nothing else, to avoid silent breakage.

And I assume that this has to be pulled for that DMD fix to work. Let's do it, shall we?

@JackStouffer
Copy link
Contributor

JackStouffer commented Jan 15, 2017

@LemonBoy Codecov is complaining; can you please manually verify that the line changed is covered?

Thanks

@LemonBoy
Copy link
Contributor Author

Looks like the those lines weren't covered even before this patch, what should I do?

@JackStouffer
Copy link
Contributor

@LemonBoy Please add a unit test

@LemonBoy
Copy link
Contributor Author

Well, I tried

@JackStouffer
Copy link
Contributor

Huh, must be a coverage bug.

@JackStouffer
Copy link
Contributor

Auto-merge toggled on

@JackStouffer JackStouffer merged commit 40bae5d into dlang:master Jan 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants