https://issues.dlang.org/show_bug.cgi?id=22221
Issue ID: 22221
Summary: [dip1000] pure function can escape parameters through
Exception
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe, Vision
Severity: normal
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
Follow up to issue 20150. The fix for that issue prevented escaping through the
return value, but had the known limitation that even when escaping through
parameters or the return value is not possible, parameters of pure functions
can still be put into an Exception and thrown:
```
void f_throw(string x) @safe pure
{
throw new Exception(x);
}
void escape_throw_20150() @safe
{
immutable(char)[4] str;
f_throw(str[]);
}
```
If the function isn't `nothrow`, the pure function -> scope parameters
implication shouldn't be done.
--