[Issue 6153] Inserting to An Array!T inside an Array!(Array!T) causes a segfault.
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed Jul 18 03:14:29 PDT 2012
http://d.puremagic.com/issues/show_bug.cgi?id=6153
Matthias Walter <xammy at xammy.info> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |xammy at xammy.info
--- Comment #3 from Matthias Walter <xammy at xammy.info> 2012-07-18 03:14:20 PDT ---
The reason for the failure is that for
arr2D[0].insert(1);
the opIndex() method is invoked which returns by value. In theory this is okay
since the array is stored by reference and the returned value contains a
reference to the payload data of the inner array.
What happens here is that arr2D[0] is uninitialized (the pointer to the
RefCounted object is null) and this guy is returned. It is then changed (the
insert method initializes the temporary and creates the ref-counted object with
the inserted content).
One way to resolve this is to make opIndex return a reference. Or is there an
alternative?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list