Hello, new dmd (2.100) has return/scope changes.
It look like examples at page https://dlang.org/spec/function.html#ref-return-scope-parameters are no longer relevant.

What difference are between `return scope`, `scope return` and `return`?
Why `void* ptr` in struct change effect of `scope return` ?


```d
@safe:

struct A{
        int  val;
        //void* ptr;

        int* test() scope return{
                return &this.val;   // OK
        }
}

struct B{
        int  val;
        void* ptr;

        int* test() return{
                return &this.val; // OK
        }
}

struct C{
        int  val;
        void* ptr;

        int* test() scope return{
return &this.val; // Error: returning `&this.val` escapes a reference to parameter `this`
        }
}


void main(){}
```

Reply via email to