[Issue 21748] Return value of forward-referenced auto ref function mistakenly treated as lvalue

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sun Mar 28 10:32:03 UTC 2021


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

uplink.coder at googlemail.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
           Assignee|nobody at puremagic.com        |uplink.coder at googlemail.com

--- Comment #2 from uplink.coder at googlemail.com ---
I can add a bit of detail.
The issue here is the determination of auto-ref.
Generally the ref-ness of a function-type does not depend on the body of the
function. auto ref being the exception.
When an auto ref function is encountered without having gone through the
semantic3 to flag isRef is set to true.
Therefore if main goes through semantic3 first, and it checks the type of fun,
it will see that fun returns ref.
If fun() is first, it will resolve the auto-ref to be non-ref.
and set the isRef of it's type to false.
Causing the isLvalue check to fail.

--


More information about the Digitalmars-d-bugs mailing list