www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 14775] New: core.exception.RangeError src/rt/aaA.d(861):


          Issue ID: 14775
           Summary: core.exception.RangeError src/rt/aaA.d(861): Range
           Product: D
           Version: D2
          Hardware: x86_64
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody puremagic.com
          Reporter: issues.dlang jmdavisProg.com

As I pointed out in issue# 14773, the druntime unit tests are unfortunately
only run in non-release mode right now, so stuff like range violations in the
tests typically aren't caught. One of the tests that fails with a range
violations if you build druntime without -release is this the one currently on
line# 861 in src/rt/aaA.d:

    alias E = void[0];
    auto aa = [E.init : E.init];
    assert(aa.length == 1);
    assert(aa.byKey.front == E.init);
    assert(aa.byValue.front == E.init);
    aa[E.init] = E.init; // This test here fails
    assert(aa.length == 1);
    assert(aa.length == 0);

So, if you either edit the makefile to build without -release or mark the
unittest block with  safe and comment out the lines calling byKey.front and
byValue.front (since those aren't  safe or  trusted apparently), then you will
see line# 861 fail with a range violation.

Jul 06 2015