Bug 13000 – Casts should be removed to utilize features of inout

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2014-06-27T20:04:00Z
Last change time
2014-06-28T18:26:24Z
Keywords
pull
Assigned to
nobody
Creator
schveiguy

Comments

Comment #0 by schveiguy — 2014-06-27T20:04:17Z
In Pull request https://github.com/D-Programming-Language/phobos/pull/2272, it was discovered that some functions in phobos had incorrectly applied inout to the return type, and to get around the compiler complaints, used casts. A dummy example: class X { int x; inout int *foo() inout { return cast(int *)&x; } } The point of this was to try and apply inout to the return value, but the left-hand side inout was redundant. The fix is to remove the cast, and properly apply inout as: inout(int)* foo() inout The above-mentioned pull removed the left-most inout, which fixes the redundancy (required by a new DMD change), but we should fix the cast properly. See the pull request for the locations that were changed.
Comment #1 by k.hara.pg — 2014-06-28T12:38:12Z
Comment #2 by github-bugzilla — 2014-06-28T18:26:23Z
Commits pushed to master at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/18efc8c5dc0606aaf8589d01d0f7229a4ce3277c fix Issue 13000 - Casts should be removed to utilize features of inout https://github.com/D-Programming-Language/phobos/commit/aab91e5f3f42d3838fddf98c956baeab9741bdad Merge pull request #2279 from 9rnsr/fix13000 Issue 13000 - Casts should be removed to utilize features of inout