www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 23985] New: [dip1000] return scope fails to infer after

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 puremagic.com
          Reporter: dkorpel 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); } ``` --
Jun 10 2023