[Issue 23917] New: "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 17:54:15 UTC 2023


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

          Issue ID: 23917
           Summary: "ref" in alias this call not detected in "auto ref"
                    return resolution
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dlang-bugzilla at thecybershadow.net

////////////////////// 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.

--


More information about the Digitalmars-d-bugs mailing list