[Issue 17422] New: [scope] class reference not initialized as scope variable
via Digitalmars-d-bugs
digitalmars-d-bugs at puremagic.com
Tue May 23 14:50:17 PDT 2017
https://issues.dlang.org/show_bug.cgi?id=17422
Issue ID: 17422
Summary: [scope] class reference not initialized as scope
variable
Product: D
Version: D2
Hardware: All
OS: All
Status: NEW
Keywords: safe
Severity: normal
Priority: P3
Component: dmd
Assignee: bugzilla at digitalmars.com
Reporter: code at dawg.eu
cat > bug.d << CODE
struct RC
{
Object get() return scope @trusted
{
return cast(Object) &store[0];
}
private:
ubyte[__traits(classInstanceSize, Object)] store;
}
Object test() @safe
{
RC rc;
auto p = rc.get; // p must be inferred as scope variable, works for int*
return p;
}
CODE
dmd -c bug -dip1000
Should raise an error but doesn't get catched by the compiler.
--
More information about the Digitalmars-d-bugs
mailing list