Bug 5925 – Comparing associative array with a type constructor (const/shared/immutable) causes segfault
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P2
Component
druntime
Product
D
Version
D2
Platform
All
OS
All
Creation time
2011-05-03T12:12:00Z
Last change time
2011-06-06T12:32:23Z
Keywords
patch, wrong-code
Assigned to
nobody
Creator
kennytm
Comments
Comment #0 by kennytm — 2011-05-03T12:12:32Z
Test case:
-----------------------
void main() {
const a = [4:0];
const b = [4:0];
assert(a == b);
}
-----------------------
This causes a NULL-pointer exception in _aaEqual. The problem is _aaEqual's signature is
int _aaEqual(TypeInfo_AssociativeArray ti, AA e1, AA e2)
// ^^^^^^^^^^^^^^^^^^^^^^^^^
but the typeid of a const AA is a TypeInfo_Const, so the 'ti.keys' used later is invalid.