[Issue 16169] New: nWayUnion assertion failure
    via Digitalmars-d-bugs 
    digitalmars-d-bugs at puremagic.com
       
    Mon Jun 13 15:15:17 PDT 2016
    
    
  
https://issues.dlang.org/show_bug.cgi?id=16169
          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 at puremagic.com
          Reporter: justin at 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 = [
        iota(1,3),
        iota(2,3),
        iota(1,3),
    ];
    auto un = nWayUnion(ror).chunkBy!`a==b`;
    import std.stdio;
    writeln(un);
}
Altering
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.
--
    
    
More information about the Digitalmars-d-bugs
mailing list