[Issue 23912] New: Destructor disables scope inference
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Thu May 11 15:00:53 UTC 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 at puremagic.com
Reporter: alphaglosined at 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 {
}
```
--
More information about the Digitalmars-d-bugs
mailing list