Bug 14765 – [Reg2.068.0] Rangified functions no longer accept types that implicitly cast to string

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2015-07-02T17:58:00Z
Last change time
2017-07-19T17:43:38Z
Assigned to
nobody
Creator
dlang-bugzilla
See also
https://issues.dlang.org/show_bug.cgi?id=15027

Comments

Comment #0 by dlang-bugzilla — 2015-07-02T17:58:08Z
///////////// test.d ///////////// import std.file; struct Stringish { string s; alias s this; } void main() { auto fn = Stringish("test.d"); readText(fn); } ////////////////////////////////// This now fails with this error output: C:\...\std\utf.d(3608,38): Error: cannot implicitly convert expression (front(this.r.s)) of type dchar to ubyte C:\...\std\utf.d(3608,38): Error: cannot implicitly convert expression (front(this.r.s)) of type dchar to ubyte C:\...\std\utf.d(3608,38): Error: cannot implicitly convert expression (front(this.r.s)) of type dchar to ubyte C:\...\std\utf.d(3442,32): Error: template instance std.utf.byDchar!(Stringish) error instantiating C:\...\std\internal\cstring.d(188,40): instantiated from here: byWchar!(Stringish) C:\...\std\file.d(245,54): instantiated from here: tempCString!(wchar, Stringish) C:\...\std\file.d(412,35): instantiated from here: read!(Stringish) test.d(12,10): instantiated from here: readText!(string, Stringish) C:\...\std\internal\cstring.d(188,5): Error: forward reference to inferred return type of function call __r3083.front() C:\...\std\internal\cstring.d(86,6): Error: function std.internal.cstring.tempCString!(wchar, Stringish).tempCString no return exp; or assert(0); at end of function
Comment #1 by code — 2015-07-21T08:13:24Z
This applies to all newly rangified functions, e.g. std.string.indexOf changes break vibe.d. We need a list of all the rangified functions for the changelog anyhow, so ideally we'd compile that list and then check each function for this bug.
Comment #2 by bugzilla — 2015-07-22T01:47:32Z
(In reply to Martin Nowak from comment #1) > This applies to all newly rangified functions, e.g. std.string.indexOf > changes break vibe.d. It applies to more than that. It turns out to be yet another facet of the autodecoding misfeature.
Comment #3 by bugzilla — 2015-07-22T05:43:35Z
Comment #4 by code — 2015-07-22T09:59:07Z
There is a slight variation of this bug, where a former Char[] parameter was replaced by Range and no longer accepts static arrays. It has been fixed for indexOf, but we should check whether other functions are affected too. https://github.com/D-Programming-Language/phobos/pull/3191
Comment #5 by github-bugzilla — 2015-07-23T22:42:11Z
Commits pushed to stable at https://github.com/D-Programming-Language/phobos https://github.com/D-Programming-Language/phobos/commit/31c963070245c2c89ae287283f49fc77425c45df add std.traits.isAutodecodableString() to fix Issue 14765 https://github.com/D-Programming-Language/phobos/commit/39806a85f5cd0f3280519277a5943e3485abd797 Merge pull request #3512 from MartinNowak/fix14765 add std.traits.isAutodecodableString() to fix Issue 14765
Comment #6 by github-bugzilla — 2015-07-25T00:03:30Z
Comment #7 by github-bugzilla — 2017-07-19T17:43:38Z
Commits pushed to dmd-cxx at https://github.com/dlang/phobos https://github.com/dlang/phobos/commit/31c963070245c2c89ae287283f49fc77425c45df add std.traits.isAutodecodableString() to fix Issue 14765 https://github.com/dlang/phobos/commit/39806a85f5cd0f3280519277a5943e3485abd797 Merge pull request #3512 from MartinNowak/fix14765