[Issue 20943] New: std.algorithm.setops.cartesianProduct fails for ranges with @system popFront
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jun 17 17:01:07 UTC 2020
https://issues.dlang.org/show_bug.cgi?id=20943
Issue ID: 20943
Summary: std.algorithm.setops.cartesianProduct fails for ranges
with @system popFront
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: regression
Priority: P1
Component: phobos
Assignee: nobody at puremagic.com
Reporter: john.loughran.colvin at gmail.com
unittest
{
import std.algorithm : cartesianProduct;
import std.algorithm : equal;
import std.typecons : tuple;
static struct SystemRange
{
int[] data;
int front() @system @property
{
return data[0];
}
bool empty() @system @property
{
return data.length == 0;
}
void popFront() @system
{
data = data[1 .. $];
}
SystemRange save() @system
{
return this;
}
}
assert(SystemRange([1, 2]).cartesianProduct(SystemRange([3, 4]))
.equal([tuple(1, 3), tuple(1, 4), tuple(2, 3), tuple(2, 4)]));
}
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/setops.d(398): Error:
scope variable r assigned to non-scope parameter this calling
onlineapp.__unittest_L1_C1.SystemRange.popFront
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/setops.d(399): Error:
scope variable r assigned to non-scope parameter this calling
onlineapp.__unittest_L1_C1.SystemRange.empty
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/setops.d(404): Error:
scope variable this assigned to non-scope parameter this calling
onlineapp.__unittest_L1_C1.SystemRange.save
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/setops.d(398): Error:
scope variable r assigned to non-scope parameter this calling
onlineapp.__unittest_L1_C1.SystemRange.popFront
/dlang/dmd/linux/bin64/../../src/phobos/std/algorithm/setops.d(399): Error:
scope variable r assigned to non-scope parameter this calling
onlineapp.__unittest_L1_C1.SystemRange.empty
onlineapp.d(32): Error: template instance
std.algorithm.setops.cartesianProduct!(SystemRange, SystemRange) error
instantiating
--
More information about the Digitalmars-d-bugs
mailing list