[Issue 23985] New: [dip1000] return scope fails to infer after assignment

d-bugmail at puremagic.com d-bugmail at puremagic.com
Sat Jun 10 17:11:22 UTC 2023


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

          Issue ID: 23985
           Summary: [dip1000] return scope fails to infer after assignment
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody at puremagic.com
          Reporter: dkorpel at live.nl

>From the newsgroup:
https://forum.dlang.org/post/ooxbnqweqyohygrvspga@forum.dlang.org

```D
// REQUIRED_ARGS: -preview=dip1000
@safe:

struct B()
{
    int* a;
    C!() c;
}

class C()
{
    C!() foo(int* a)
    {
        return foo2(a);
    }

    C!() foo2(int* a)
    {
        auto b = B!()(a);
        return b.c;
    }
}

void main()
{
    scope int* a;
    C!() c;
    // Error: scope variable `a` assigned to non-scope parameter `a` calling
`foo`
    c.foo(a);
}
a);
}
```

--


More information about the Digitalmars-d-bugs mailing list