Flatten a range of static arrays

ag0aep6g anonymous at example.com
Sat Feb 8 20:48:16 UTC 2020


On 08.02.20 07:27, ag0aep6g wrote:
> On 08.02.20 02:38, ag0aep6g wrote:
>> Simplified, we're looking at this:
>>
>> ----
>> struct Joiner
>> {
>>      int[3] _items;
>>      int[] _current;
>> }
>> void main() @safe
>> {
>>      Joiner j;
>>      j._current = j._items[];
>> }
>> ----
[...]
> In the first reduction, `j` might be `scope`, but `j._items` has no 
> indirections. `scope` doesn't actually mean anything for it. It's just 
> an `int[3]` on the stack. So taking its address could be allowed.
> 
> But (the current implementation of) DIP 1000 is apparently too 
> conservative for that. It seems to treat pointers into a struct the same 
> as pointers to the whole thing.

My attempt at lifting this limitation:

https://github.com/dlang/dmd/pull/10773


More information about the Digitalmars-d-learn mailing list