[Issue 19532] chunkBy assert error involving reference input ranges.

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Jan 3 07:54:50 UTC 2019


https://issues.dlang.org/show_bug.cgi?id=19532

--- Comment #2 from Jon Degenhardt <jrdemail2000-dlang at yahoo.com> ---
Another example, this one involving multiwayMerge.

-------- case3.d ---------
import std.stdio;
import std.range;
import std.algorithm : chunkBy, multiwayMerge;

auto inputRangeStruct(R)(R range) { return InputRangeStruct!R(range); }

void main(string[] args)
{
    auto x1 = [0, 1, 3, 6];
    auto x2 = [0, 2, 4, 6, 7];
    auto x3 = [1, 2, 4, 6, 8, 8, 9];
    auto x4 = [1, 3, 5, 6];

    auto y = [x1, x2, x3, x4]
        .multiwayMerge
        .chunkBy!((a, b) => a == b);

    writeln(y);
}
---------------------------

This fails similarly to the other cases.

$ dmd case3.d
jondegenhardt at mac:merge_groupby$ ./case3
core.exception.AssertError@/Users/jondegenhardt/devtools/dmd2-2.083.1/osx/bin/../../src/phobos/std/range/primitives.d(2219):
Attempting to popFront() past the end of an array of int
----------------
??:? _d_assert_msg [0xea781fe]
??:? pure nothrow @nogc @safe void
std.range.primitives.popFront!(int).popFront(ref int[]) [0xea5ee5e]
??:? pure void std.algorithm.setops.MultiwayMerge!("a < b",
int[][]).MultiwayMerge.popFront() [0xea5c623]
??:? pure void
std.algorithm.iteration.ChunkByChunkImpl!(case3.main(immutable(char)[][]).__lambda2,
std.algorithm.setops.MultiwayMerge!("a < b",
int[][]).MultiwayMerge).ChunkByChunkImpl.popFront() [0xea5f494]

... more lines of stack trace ...

??:? _Dmain [0xea5c44d]
[[0, 0], [1, 1, 1], [2, 2], [3, 3], [4, 4], [5], [6, 6, 6, 6], [7$

--


More information about the Digitalmars-d-bugs mailing list