[Issue 2788] return val not passable via ref const in other method

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Aug 12 13:15:39 UTC 2019


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

RazvanN <razvan.nitu1305 at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |razvan.nitu1305 at gmail.com
         Resolution|---                         |INVALID

--- Comment #2 from RazvanN <razvan.nitu1305 at gmail.com> ---
`getVar()` is an rvalue, therefore it cannot be passed to a ref parameter.
Therefore the bug report is invalid.

>struct A {}
>void foo(ref A a) {}
>void main()
>{
>    foo(A());
>}

This doesn't compiler and neither does this:

>static A bar()
>{
>    return A();
>}
>
>foo(bar());

Closing as invalid.

--


More information about the Digitalmars-d-bugs mailing list