www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.bugs - [Issue 17422] New: [scope] class reference not initialized as scope


          Issue ID: 17422
           Summary: [scope] class reference not initialized as scope
           Product: D
           Version: D2
          Hardware: All
                OS: All
            Status: NEW
          Keywords: safe
          Severity: normal
          Priority: P3
         Component: dmd
          Assignee: bugzilla digitalmars.com
          Reporter: code dawg.eu

cat > bug.d << CODE
struct RC
    Object get() return scope  trusted
        return cast(Object) &store[0];

    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;
dmd -c bug -dip1000

Should raise an error but doesn't get catched by the compiler.

May 23 2017