[Issue 10613] New: cartesianProduct of const arrays

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jul 11 10:50:18 PDT 2013


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

           Summary: cartesianProduct of const arrays
           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-07-11 10:50:17 PDT ---
import std.algorithm: cartesianProduct;
void main() {
    auto a = [1, 2];
    cartesianProduct(a, a); // OK
    const b = [1, 2];
    cartesianProduct(b, b); // Error
}



dmd 2.064alpha gives:

...\dmd2\src\phobos\std\range.d(4158): Error: cannot modify struct
result._ranges_field_1 Repeat!const(int) with immutable members
...\dmd2\src\phobos\std\range.d(4454): Error: template instance
std.range.Zip!(const(int)[], Repeat!const(int)) error instantiating
...\dmd2\src\phobos\std\algorithm.d(11423):        instantiated from here:
zip!(const(int)[], Repeat!const(int))
test.d(6):        instantiated from here: cartesianProduct!(const(int)[],
const(int)[])
...\dmd2\src\phobos\std\algorithm.d(11423): Error: template instance
std.range.zip!(const(int)[], Repeat!const(int)) error instantiating
test.d(6):        instantiated from here: cartesianProduct!(const(int)[],
const(int)[])
test.d(6): Error: template instance
std.algorithm.cartesianProduct!(const(int)[], const(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