[Issue 17734] __traits(isRef) cannot currently be used to distinguish l-value from r-value passing of `this`

via Digitalmars-d-bugs digitalmars-d-bugs at puremagic.com
Tue Aug 8 11:52:21 PDT 2017


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

Steven Schveighoffer <schveiguy at yahoo.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
                 CC|                            |schveiguy at yahoo.com

--- Comment #1 from Steven Schveighoffer <schveiguy at yahoo.com> ---
This is because `this` is always accepted by reference, even for rvalues. This
is, in fact, the only place an rvalue will bind to a reference.

So this is as designed, at least for __traits(isRef). I don't think there's any
way to fix this, unless you templated each function and accepted `this` by
value when called from rvalues.

I recommend closing, this enhancement isn't going to happen.

--


More information about the Digitalmars-d-bugs mailing list