Limit Scope Restriction? with dmd -dip25 -dip1000

apz28 home at home.com
Sat Apr 3 15:32:38 UTC 2021


@safe:

class Foo
{
@safe:

     ubyte[] bytes()
     {
         return new ubyte[1];
     }
}

ubyte[] getBytes()
{
     scope foo = new Foo();
     return foo.bytes(); // Error: scope variable foo assigned to 
non-scope parameter this calling Foo.bytes
}

void main()
{	
     auto v = getBytes();
}


More information about the Digitalmars-d mailing list