Bug 14775 – core.exception.RangeError@src/rt/aaA.d(861): Range violation

Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P1
Component
druntime
Product
D
Version
D2
Platform
x86_64
OS
FreeBSD
Creation time
2015-07-06T09:57:00Z
Last change time
2015-07-09T04:01:37Z
Assigned to
nobody
Creator
issues.dlang
Blocks
14773

Comments

Comment #0 by issues.dlang — 2015-07-06T09:57:36Z
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.
Comment #1 by issues.dlang — 2015-07-09T04:01:37Z