[Issue 13935] New: Problem with std.algorithm.cartesianProduct(map, map)
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Sun Jan 4 20:49:07 PST 2015
https://issues.dlang.org/show_bug.cgi?id=13935
Issue ID: 13935
Summary: Problem with std.algorithm.cartesianProduct(map, map)
Product: D
Version: D2
Hardware: x86
OS: Windows
Status: NEW
Keywords: rejects-valid
Severity: normal
Priority: P1
Component: Phobos
Assignee: nobody at puremagic.com
Reporter: bearophile_hugs at eml.cc
void main() {
import std.algorithm: map, cartesianProduct;
auto seq = [1, 2].map!(x => x);
foreach (pair; cartesianProduct(seq, seq)) {}
}
dmd 2.067alpha gives:
...\dmd2\src\phobos\std\algorithm.d(14489,20): Error: function
std.algorithm.cartesianProduct!(MapResult!(__lambda1, Result),
MapResult!(__lambda1, Result)).cartesianProduct.Result.save cannot get frame
pointer to main
...\dmd2\src\phobos\std\algorithm.d(14489,20): Error: function
std.algorithm.cartesianProduct!(MapResult!(__lambda1, Result),
MapResult!(__lambda1, Result)).cartesianProduct.Result.save cannot get frame
pointer to main
...\dmd2\src\phobos\std\algorithm.d(14489,20): Error: function
std.algorithm.cartesianProduct!(MapResult!(__lambda1, Result),
MapResult!(__lambda1, Result)).cartesianProduct.Result.save cannot get frame
pointer to main
...\dmd2\src\phobos\std\algorithm.d(14489,20): Error: function
std.algorithm.cartesianProduct!(MapResult!(__lambda1, Result),
MapResult!(__lambda1, Result)).cartesianProduct.Result.save cannot get frame
pointer to main
Taking a look at the std.algorithm.cartesianProduct implementation:
auto cartesianProduct(RR...)(RR ranges)
if (ranges.length >= 2 &&
allSatisfy!(isForwardRange, RR) &&
!anySatisfy!(isInfinite, RR))
{
...
static struct Result
{
...
@property Result save()
{
Result copy; // Error message here *******
foreach (i, r; ranges)
{
copy.ranges[i] = r.save;
copy.current[i] = current[i].save;
}
copy.empty = this.empty;
return copy;
}
}
...
-----------------------
--
More information about the Digitalmars-d-bugs
mailing list