www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23914] New: "auto ref" determination prevented by bottom type

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

          Issue ID: 23914
           Summary: "auto ref" determination prevented by bottom type
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody puremagic.com
          Reporter: dlang-bugzilla thecybershadow.net

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

    auto ref fun()
    {
        if (true)
            return nc;
        else
            return assert(false);
    }
}
//////////////////////////////////

Compiler says:

test.d(9): Error: struct `test.NC` is not copyable because it has a disabled
postblit

Looks like it prevented "auto ref" from being resolved into "ref", even though
explicitly returning by ref seems to work.

--
May 12 2023