[Issue 10753] New: std.array.array of a range of structs with immutable fields too
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sat Aug 3 07:02:12 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=10753
Summary: std.array.array of a range of structs with immutable
fields too
Product: D
Version: D2
Platform: x86
OS/Version: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P2
Component: Phobos
AssignedTo: nobody at puremagic.com
ReportedBy: bearophile_hugs at eml.cc
--- Comment #0 from bearophile_hugs at eml.cc 2013-08-03 07:02:11 PDT ---
import std.algorithm: map;
import std.array: array;
struct Foo {
immutable dchar d;
}
struct Bar {
immutable int x;
}
void main() {
"12".map!Foo.array;
[1, 2].map!Bar.array;
}
DMD 2.064alpha gives:
...\dmd2\src\phobos\std\array.d(2309): Error: cannot modify struct delegate
Foo[]()
{
return (cast(Foo*)(*this._data).arr)[len..len + 1u];
}
()[0u] Foo with immutable members
...\dmd2\src\phobos\std\array.d(69): Error: template instance
std.array.Appender!(Foo[]).Appender.put!(Foo) error instantiating
temp.d(10): instantiated from here: array!(MapResult!(Foo, string))
temp.d(10): Error: template instance std.array.array!(MapResult!(Foo, string))
error instantiating
...\dmd2\src\phobos\std\array.d(58): Error: cannot modify struct result[i] Bar
with immutable members
temp.d(11): Error: template instance std.array.array!(MapResult!(Bar, int[]))
error instantiating
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list