Bug 6075 – Cannot set value to associative array from a weakly-pure function when the value type has a (pure) opAssign

Status
RESOLVED
Resolution
FIXED
Severity
regression
Priority
P2
Component
dmd
Product
D
Version
D2
Platform
Other
OS
Mac OS X
Creation time
2011-05-29T09:01:00Z
Last change time
2011-06-27T07:27:32Z
Keywords
patch, rejects-valid
Assigned to
nobody
Creator
kennytm

Comments

Comment #0 by kennytm — 2011-05-29T09:01:33Z
Test case: ---------------------------------------- struct S { void opAssign(in int other) pure { } } void add() pure { S[int] d; d[0] = 1; } ---------------------------------------- x.d(7): Error: variable __aatmp3 forward referenced x.d(7): Error: pure nested function 'add' cannot access mutable data '__aatmp3' x.d(7): Error: variable __aatmp3 forward referenced x.d(7): Error: pure nested function 'add' cannot access mutable data '__aatmp3' x.d(7): Error: variable __aatmp3 forward referenced x.d(7): Error: pure nested function 'add' cannot access mutable data '__aatmp3' ---------------------------------------- The bug is introduced somewhere between 2.048 and 2.052.
Comment #1 by kennytm — 2011-06-06T03:27:16Z
The bug was introduced in commit 44d7881 (fix bug 2451), manifesting itself as a Segfault (null pointer dereferencing). The Segfault was later converted to an error in commit 37aacfc (bug 5131). https://github.com/D-Programming-Language/dmd/commit/44d7881 https://github.com/D-Programming-Language/dmd/commit/37aacfc
Comment #2 by kennytm — 2011-06-18T10:02:33Z
Comment #3 by kennytm — 2011-06-27T07:27:32Z