Bug 11702 – std.string.splitLines to immutable result
Status
RESOLVED
Resolution
FIXED
Severity
enhancement
Priority
P2
Component
phobos
Product
D
Version
D2
Platform
All
OS
All
Creation time
2013-12-07T05:53:19Z
Last change time
2020-03-21T03:56:35Z
Assigned to
No Owner
Creator
bearophile_hugs
Comments
Comment #0 by bearophile_hugs — 2013-12-07T05:53:19Z
void main() pure {
import std.string;
immutable parts = "5\n6".splitLines;
}
splitLines can be used in a pure function, but its result can't yet be assigned to an immutable (dmd 2.065alpha):
temp.d(3): Error: cannot implicitly convert expression (splitLines("5\x0a6", cast(KeepTerminator)false)) of type string[] to immutable(char[][])
Even this fails with a similar error:
void main() pure {
import std.string;
immutable s = "5\n6";
immutable parts = s.splitLines;
}