BetterC Bug? Intended Behavior? Asking Here As Unsure

kinke noone at nowhere.com
Tue Jul 7 00:02:47 UTC 2020


On Monday, 6 July 2020 at 22:02:37 UTC, Kayomn wrote:
> On Monday, 6 July 2020 at 21:09:57 UTC, kinke wrote:
>> Similar case here; the 'varargs' end up in a GC-allocated 
>> array. I've recently changed `scope` slice params, so that 
>> array literal arguments are allocated on the caller's stack 
>> instead; so adding `scope` for these variadics *should* 
>> probably do the same:
>>
>> void tester(Test test, scope Test[] tests...);
>
> This doesn't seem to be the case as the issue persists in the 
> same manner.
> https://run.dlang.io/is/LcaKeu

I meant 'should' as in 'should be fixed to do the same', as this 
works with -betterC:

struct Test { ~this() {} }
void tester(Test test, scope Test[] tests) { }

extern(C) void main() {
     tester(Test(), [Test()]);
}


More information about the Digitalmars-d-learn mailing list