March 19, 2019
https://issues.dlang.org/show_bug.cgi?id=19754

          Issue ID: 19754
           Summary: cast() sometimes yields lvalue, sometimes yields
                    rvalue
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: andrei@erdani.com

Consider:

shared int x;
(cast() x) = 5;
assert(x == 5);

So the cast yields an lvalue. However:

shared int x;
auto p = &(cast() x);

This does not compile claiming that the result of cast is an rvalue. Should pass and use an lvalue.

Same for this:

int x;
(cast(shared) x) = 5;
assert(x == 5);
...
auto p = &(cast(shared) x);

--