[Issue 23914] New: "auto ref" determination prevented by bottom type

d-bugmail at puremagic.com d-bugmail at puremagic.com
Fri May 12 12:28:13 UTC 2023


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

--


More information about the Digitalmars-d-bugs mailing list