Issue 20809

Timon Gehr timon.gehr at gmx.ch
Tue Jun 9 13:25:02 UTC 2020


On 09.06.20 13:16, foerdi wrote:
> Hi,
> 
> It would be great if someone could take care of the regression 
> https://issues.dlang.org/show_bug.cgi?id=20809.
> This issue hold me back to use a newer version of the dmd compiler.
> 
> Unfortunately my internal knowledge of the dmd compiler is not large 
> enough to fix this issue my self.
> 
> It seems to be a result of the PR: 
> https://github.com/dlang/dmd/pull/10577, thanks to moonlightsentinel to 
> figure this out.
> ...

As far as I can tell, the optimization was wrong all along, and the PR 
just extends it to all cases where the return expression is an lvalue.

A possible fix would be to always create a temporary variable that 
stores the return expression and let it be a reference based on whether 
or not its address is actually taken instead of whether or not it is an 
lvalue, but I am not sure how to do that in DMD.


More information about the Digitalmars-d mailing list