March 17, 2020
https://issues.dlang.org/show_bug.cgi?id=20682

          Issue ID: 20682
           Summary: [DIP1000] wrong error: scope variable may not be
                    copied into allocated memory
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: rejects-valid, safe
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: ag0aep6g@gmail.com

Similar to issue 20675.

----
struct D
{
    int pos;
    char* p;
}

int f1(return scope ref D d) @safe
{
    return d.pos;
}

ref int f2(return scope ref D d) @safe
{
    return d.pos;
}

void test(scope ref D d) @safe
{
    int[] da;
    da ~= f1(d);
    da ~= f2(d);
}
----

--