Bug 17422 – [scope] class reference not initialized as scope variable
Status
RESOLVED
Resolution
FIXED
Severity
normal
Priority
P3
Component
dmd
Product
D
Version
D2
Platform
All
OS
All
Creation time
2017-05-23T21:50:00Z
Last change time
2017-08-07T13:16:21Z
Keywords
safe
Assigned to
bugzilla
Creator
code
Comments
Comment #0 by code — 2017-05-23T21:50:17Z
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.