www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23917] New: "ref" in alias this call not detected in "auto

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 puremagic.com
          Reporter: dlang-bugzilla 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.

--
May 12 2023