More on C++ stack arrays

Iain Buclaw ibuclaw at ubuntu.com
Mon Oct 21 13:32:26 PDT 2013


On 21 October 2013 21:24, Timon Gehr <timon.gehr at gmx.ch> wrote:
> On 10/21/2013 07:53 PM, Iain Buclaw wrote:
>>
>> On 21 October 2013 18:42, Walter Bright <newshound2 at digitalmars.com>
>> wrote:
>>>
>>> On 10/21/2013 9:24 AM, Iain Buclaw wrote:
>>>>
>>>>
>>>> http://dpaste.dzfl.pl/3e333df6
>>>>
>>>> PS:  Walter, looks the above causes an ICE in DMD?
>>>
>>>
>>>
>>> All ICE's should be filed in bugzilla:
>>>
>>> http://d.puremagic.com/issues/show_bug.cgi?id=11315
>>>
>>
>> I've told enough people to raise bugs in GDC to know this.  My
>> intention wasn't to find a bug in DMD though when I pasted that link.
>> ;-)
>>
>> I was more curious what LDC does if it stack allocates array literals
>> assigned to static arrays in that program.  My guess is that the
>> dynamic array will get the address of the stack allocated array
>> literal, and it's values will be lost after calling fill();
>>
>> If so, this is another bug that needs to be filled and fixed.
>>
>
> Why? AFAICS it is the expected behaviour in any case.

It's an assignment to a dynamic array, so it should invoke the GC and
do a _d_arraycopy.


-- 
Iain Buclaw

*(p < e ? p++ : p) = (c & 0x0f) + '0';


More information about the Digitalmars-d mailing list