bug in assigning to dynamic array element
anonymous via Digitalmars-d
digitalmars-d at puremagic.com
Sat Nov 1 04:31:51 PDT 2014
On Saturday, 1 November 2014 at 09:03:42 UTC, ketmar via
Digitalmars-d wrote:
> as i can guess, the bug is in evaluating left part of '='
> operation
> before the right part.
I don't know how D defines this, and I couldn't find anything but
a forum discussion [1] (which I didn't read all of). But unless
it's explicitly stated that the right-hand side is evaluated
first, there is no bug.
A simpler test case:
auto list = new size_t[1];
list[0] = (){list = new size_t[1]; return 666;}();
assert(list[0] == 666);
[1] http://forum.dlang.org/thread/gu4bqu$bq$1@digitalmars.com
More information about the Digitalmars-d
mailing list