[Issue 21369] Compiler doesn't allow lvalues via alias this when wrapper is an rvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat May 8 19:41:27 UTC 2021


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

apham <apz28 at hotmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |apz28 at hotmail.com

--- Comment #2 from apham <apz28 at hotmail.com> ---
Create temp var is OK

struct S
{
   int *val;
   ref int get() { return *val; }
   alias get this;
}

void foo(ref int x) {}

void main()
{
   int x;
   auto s = S(&x);
   foo(s);
}

--


More information about the Digitalmars-d-bugs mailing list