https://issues.dlang.org/show_bug.cgi?id=17428
Issue ID: 17428
Summary: [scope] class field assignment allows to escape scope
parameters
Product: D
Version: D2
Hardware: x86_64
OS: Linux
Status: NEW
Keywords: safe
Severity: enhancement
Priority: P1
Component: dmd
Assignee: [email protected]
Reporter: [email protected]
cat > bug.d << CODE
class Klazz
{
void set(scope int* p) @safe
{
_p = p; // should error, works for structs
}
int* _p;
}
Klazz test() @safe
{
int a;
auto p = new Klazz();
p.set(&a);
return p;
}
CODE
dmd -c bug -dip1000
--