[Issue 23917] "ref" in alias this call not detected in "auto ref" return resolution

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 12 18:03:02 UTC 2023


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

--- Comment #1 from Vladimir Panteleev <dlang-bugzilla at thecybershadow.net> ---
Something weird also happens when you try to pass it as a parameter to a ref
function. A non-templated function works, but a function templated on the
argument/return type fails!

///////////////////// test.d ////////////////////
struct NC { @disable this(this); }

struct A
{
    @property ref NC value() { assert(false); }
    alias value this;
}

A a;

ref NC f1(ref return NC value) { return value; }
auto ref NC get1() { return f1(a); } // OK

ref T f2(T)(ref return T value) { return value; }
auto ref NC get2() { return f2(a); } // Error
/////////////////////////////////////////////////

--


More information about the Digitalmars-d-bugs mailing list