[Issue 14775] New: core.exception.RangeError at src/rt/aaA.d(861): Range violation

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Mon Jul 6 02:57:36 PDT 2015


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

          Issue ID: 14775
           Summary: core.exception.RangeError at src/rt/aaA.d(861): Range
                    violation
           Product: D
           Version: D2
          Hardware: x86_64
                OS: FreeBSD
            Status: NEW
          Severity: enhancement
          Priority: P1
         Component: druntime
          Assignee: nobody at puremagic.com
          Reporter: issues.dlang at 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:

unittest
{
    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.remove(E.init));
    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.

--


More information about the Digitalmars-d-bugs mailing list