Bug 16663 – [REG 2.072] std.unit.toUpper rejects an alias this to a string
Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P1
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2016-11-06T14:40:00Z
Last change time
2017-01-16T23:24:44Z
Assigned to
nobody
Creator
b2.temp
Comments
Comment #0 by b2.temp — 2016-11-06T14:40:21Z
struct String
{
string data;
alias data this;
}
void main()
{
import std.uni : toUpper;
auto u = toUpper(String("a"));
}
works with DMD 2.071.2
with DMD 2.072 we get an error.
Comment #1 by public — 2016-11-10T16:52:14Z
Checked, doesn't work with DMD 2.071.2 either. Looking at std.uni history, `toUpper` seems to have never accepted `alias this` string because of `isSomeString!T` constraint.
Are you sure you haven't missed some context?
Comment #2 by public — 2016-11-10T16:58:55Z
Nevermind, I have found my mistake. Can reproduce indeed.
This probably falls under the same argument: this String is not supposed to be a range. Maybe extension of range functions to collections (autorangification) is in order.
Comment #5 by github-bugzilla — 2016-11-20T22:47:22Z