Comment #0 by dlang-bugzilla — 2023-05-12T17:54:15Z
////////////////////// test.d /////////////////////
struct NC { @disable this(this); }
struct S
{
struct A
{
@property ref NC value() { assert(false); }
alias value this;
}
A a;
auto ref NC get() return
{
return a;
}
}
///////////////////////////////////////////////////
Compiler says:
test.d(14): Error: struct `test.NC` is not copyable because it has a disabled postblit
However, changing "auto ref" to "ref" makes it work.
Comment #1 by dlang-bugzilla — 2023-05-12T18:03:02Z
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
/////////////////////////////////////////////////
Comment #2 by dlang-bugzilla — 2023-05-12T20:55:14Z
(Oops, ignore above comment, got my return types mixed up.)
Comment #3 by robert.schadek — 2024-12-13T19:28:55Z