Issue 20809

Timon Gehr timon.gehr at gmx.ch
Tue Jun 9 13:40:38 UTC 2020


On 09.06.20 15:25, Timon Gehr wrote:
> 
> As far as I can tell, the optimization was wrong all along

Here's a case that fails for the same reason with DMD 2.089.1 (i.e., 
even before the pull request that introduced the regression):

@safe:
struct S{
     @safe:
     int[8] a;
     ~this(){ a[] = 0; }
     ref val(){ return a; }
}
S bar(){ return S([2,2,2,2,2,2,2,2]); }
int[8] foo(){ return bar.val; }

void main(){ assert(foo() == [2,2,2,2,2,2,2,2]); } // error

However, just removing the wrong transformation will not work, because 
that would delete the "fix" of issue 20401.


More information about the Digitalmars-d mailing list