May 11, 2023
https://issues.dlang.org/show_bug.cgi?id=23912

          Issue ID: 23912
           Summary: Destructor disables scope inference
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Severity: normal
          Priority: P1
         Component: dmd
          Assignee: nobody@puremagic.com
          Reporter: alphaglosined@gmail.com

Adding a destructor to an otherwise DIP1000 scope aware struct stops scope automatic inference when used in an expression and passed to say a function.

Known for frontend 2.102.

Output with destructor: <source>(12): Error: scope variable `input` assigned to
non-scope `Test(null)`

```d
struct Test {
    string val;

    this(return scope string val) scope @safe {
    }

    ~this() scope @safe {
    }
}

void giver(scope string input) @safe {
    accepts(Test(input));
}

void accepts(scope Test test) @safe {
}
```

--