[Issue 11387] New: Tuple of dynamic array literal can't be immutable

d-bugmail at puremagic.com d-bugmail at puremagic.com
Wed Oct 30 12:35:35 PDT 2013


http://d.puremagic.com/issues/show_bug.cgi?id=11387

           Summary: Tuple of dynamic array literal can't be immutable
           Product: D
           Version: D2
          Platform: All
        OS/Version: All
            Status: NEW
          Keywords: rejects-valid
          Severity: enhancement
          Priority: P2
         Component: DMD
        AssignedTo: nobody at puremagic.com
        ReportedBy: bearophile_hugs at eml.cc


--- Comment #0 from bearophile_hugs at eml.cc 2013-10-30 12:35:33 PDT ---
A low-priority enhancement suggestion:


import std.typecons: tuple;
void main() {
    immutable t = tuple([1, 2]);
}


dmd 2.064beta3 gives:

test.d(3): Error: cannot implicitly convert expression (tuple([1, 2])) of type
Tuple!(int[]) to immutable(Tuple!(int[]))

I presume built-in tuples could do this too.

To do this with Phobos-defined tuples, there should be a way to know that the
input dynamic array is pure. I don't know if and how this can be done.

-- 
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