Bug 8070 – associative array element is created before value is ready

Status
RESOLVED
Resolution
DUPLICATE
Severity
normal
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2012-05-09T00:03:00Z
Last change time
2012-05-09T00:21:06Z
Assigned to
nobody
Creator
luka8088

Comments

Comment #0 by luka8088 — 2012-05-09T00:03:22Z
I may be mistaken but, as far as I know the fact that 'arr["x"] is created and set to null' before 'new object of class A is created' is a bug. Right ? -------------------------------------------------------- /* Order of execution (is this a bug ?): * - arr["x"] is created and set to null * - new object of class A is created * - arr["x"] is set to newly created object */ module program; A[string] arr; class A { this () { // at this point: // ("x" in arr) is true // arr["x"] is set to null } } void main () { arr["x"] = new A(); }
Comment #1 by issues.dlang — 2012-05-09T00:21:06Z
*** This issue has been marked as a duplicate of issue 3825 ***