[Issue 19754] New: cast() sometimes yields lvalue, sometimes yields rvalue
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Tue Mar 19 16:08:00 UTC 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 at puremagic.com
Reporter: andrei at 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);
--
More information about the Digitalmars-d-bugs
mailing list