[Issue 23160] New: template alias parameters can be used to bypass escape checks
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Sun Jun 5 04:54:32 UTC 2022
https://issues.dlang.org/show_bug.cgi?id=23160
Issue ID: 23160
Summary: template alias parameters can be used to bypass escape
checks
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Severity: major
Priority: P1
Component: dmd
Assignee: nobody at puremagic.com
Reporter: bugzilla at digitalmars.com
Compile with -preview=dip1000
```
@safe:
struct Forward(alias P)
{
int* call() { return P; }
}
auto bar(int i) @safe
{
int* p = &i;
return Forward!(p)(); // should give an error here
}
void main()
{
assert(*bar(3).call() == 3);
}
```
the value of `p` wrongly escapes `bar()`.
--
More information about the Digitalmars-d-bugs
mailing list