[Issue 17428] New: [scope] class field assignment allows to escape scope parameters
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Wed May 24 14:39:42 PDT 2017
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: nobody at puremagic.com
Reporter: code at dawg.eu
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
--
More information about the Digitalmars-d-bugs
mailing list