https://d.puremagic.com/issues/show_bug.cgi?id=11914

           Summary: Missed tuple unpacking in foreach for cartesianProduct
           Product: D
           Version: D2
          Platform: x86
        OS/Version: Windows
            Status: NEW
          Severity: regression
          Priority: P2
         Component: DMD
        AssignedTo: [email protected]
        ReportedBy: [email protected]


--- Comment #0 from [email protected] 2014-01-13 04:55:25 PST ---
This program compiles:


void main() {
    import std.algorithm: cartesianProduct;
    foreach (ijk; cartesianProduct([1], [1], [1])) {}
}


This doesn't compile, but it used to compile:

void main() {
    import std.algorithm: cartesianProduct;
    foreach (i, j, k; cartesianProduct([1], [1], [1])) {}
}


dmd 2.065alpha gives:

test.d(3): Error: cannot infer argument types



If I add both it compiles again:

void main() {
    import std.algorithm: cartesianProduct;
    foreach (ijk; cartesianProduct([1], [1], [1])) {}
    foreach (i, j, k; cartesianProduct([1], [1], [1])) {}
}



(Generally I think this tuple unpacking is a misfeature of D and should be
removed, and replaced by a better and more general solution. But if we want to
remove this feature, it should go through a deprecation path, and not break
randomly as here. So I have marked this as regression).

-- 
Configure issuemail: https://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------

Reply via email to