www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 16169] New: nWayUnion assertion failure


          Issue ID: 16169
           Summary: nWayUnion assertion failure
           Product: D
           Version: D2
          Hardware: x86_64
                OS: Linux
            Status: NEW
          Severity: critical
          Priority: P1
         Component: phobos
          Assignee: nobody puremagic.com
          Reporter: justin economicmodeling.com

nWayUnion fails when used with chunkBy with the following:

object.Exception /home/justin/.dvm/compilers/dmd-2.071.1-b2/linux/bin/../../src/phobos/std/container/binaryheap.d(234):
Cannot call front on an empty heap.

Using this test case:

import std.range, std.algorithm;
void main(string[] args)
    auto ror = [

    auto un = nWayUnion(ror).chunkBy!`a==b`;

    import std.stdio;

https://github.com/dlang/phobos/blob/master/std/algorithm/setops.d#L812 to
check `_heap.empty` seems to correct the problem, but raises the issue of how
the _heap and _ror are getting out of sync.  Removing the `chunkBy` from the
test case also eliminates the issue, suggesting that it's the conjunction of
the two.

Jun 13 2016