Fix issue 11006 - Make sure the same type is used in pointer ops#6440
Fix issue 11006 - Make sure the same type is used in pointer ops#6440LemonBoy wants to merge 3 commits intodlang:masterfrom LemonBoy:b11006
Conversation
LemonBoy
commented
Jan 13, 2017
|
It's better to also check error message in test. |
|
Good idea, I've amended the test case. |
|
Deprecate first |
| Type p1 = t1.nextOf(); | ||
| Type p2 = t2.nextOf(); | ||
|
|
||
| if (!p1.equivalent(p2)) |
There was a problem hiding this comment.
I'd expect this to break a lot of code, maybe rather require types of same size than requiring identity?
There was a problem hiding this comment.
Phobos and druntime have been mostly chill as all the errors were due to the use of void* and byte*. Relying on the size of the types still allows the user to mix and match the types which is not what you want in 99% of the cases (and if you really need to do so you're just explicit cast away) as some types may vary between platforms and one may end up enlarging/shrinking one of the types involved and end up with a not so nice compilation error.
I root for following the specification here.
| d_int64 stride; | ||
|
|
||
| // make sure pointer types are compatible | ||
| if (Expression ex = typeCombine(this, sc)) |
There was a problem hiding this comment.
Smells like this could do more than just dealing with void*.
There was a problem hiding this comment.
It just brings the types down to a common one, I couldn't find a case where something more than that was being done.
|
Should this go trough the deprecation phase too? I think this is a bugfix since we stray away from the specification here. |
Doesn't matter if it's a bug fix or not, if it breaks code and there is a sane depreciation path we have to take it. Remember that a single occurrence in an unused code path in a library will cause downstream projects to fail to compile. That's not something acceptable. |
|
Are pointers with different modifiers handled correctly? eg |
|
Sure, the |
|
Revived at #7332 |
|
You're just grabbing the commits and throwing away all the informations about the author, that's not nice. |
Not at all. I've posted links in the old PRs to the new PRs, and from the new PRs to the old PRs. So there is an audit trail that anyone can follow. In terms of the source code itself, there was no copyright or other information about the author to keep, otherwise I would have kept it. If you're concerned about the merge being in your name, revive them yourself. |