[Issue 5074] New: array(immutable(int)[]) ==> int[]
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Mon Oct 18 19:03:26 PDT 2010
http://d.puremagic.com/issues/show_bug.cgi?id=5074
Summary: array(immutable(int)[]) ==> int[]
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 2010-10-18 19:02:48 PDT ---
This is more an enhancement request than a bug report.
In my opinion an array() applied on an array has to act like "dup", just like
array(static_array) returns a dynamic array. So I think array(immutable(int)[])
has to return an int[].
With DMD 2.049 array(immutable(int)[]) doesn't work:
import std.array: array;
void main() {
int[4] a0 = [2, 3, 1, 4];
static assert(is(typeof(array(a0)) == int[])); // OK
immutable(int)[] a1 = [2, 3, 1, 4];
int[] a2 = a1.dup;
int[] a3 = array(a1); // ERROR
}
Errors generated:
...\dmd\src\phobos\std\array.d(64): Error: result[i] isn't mutable
...\dmd\src\phobos\std\array.d(7): Error: template instance
std.array.array!(immutable(int)[]) error instantiating
test.d(7): Error: cannot implicitly convert expression (array(a1)) of type
immutable(int)[] to int[]
--
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