[Issue 21312] [REG 2.095] Newly triggered <expr> is not an lvalue and cannot be modified

d-bugmail at puremagic.com d-bugmail at puremagic.com
Thu Oct 15 19:29:04 UTC 2020


https://issues.dlang.org/show_bug.cgi?id=21312

Iain Buclaw <ibuclaw at gdcproject.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |ibuclaw at gdcproject.org

--- Comment #1 from Iain Buclaw <ibuclaw at gdcproject.org> ---
So if looks like you are using `&[foo()][0]` to get around the fact that call
expressions aren't lvalues (e.g: `&foo()`).

Two questionable aspects of this come to mind.

1. There's nothing to prevent the optimizer removing the `[ ][0]` as being
redundant.

2. There's nothing to prevent the array literal being stack allocated.

I'm not entirely sure of the validity of this, but I'll stop short of saying it
is invalid.

--


More information about the Digitalmars-d-bugs mailing list