Why can't I give a function's return type the scope storage class?
Walter Bright
newshound2 at digitalmars.com
Tue Mar 19 02:05:04 UTC 2019
On 3/18/2019 10:22 AM, Meta wrote:
> struct Test
> {
> int n = 3;
>
> @safe
> int* test() return
> {
> return &n;
> }
>
> @safe
> scope int* test() return
> {
> return &n;
> }
>
> @safe
> scope int* test() return scope
> {
> return &n;
> }
> }
>
An explicit scope doesn't apply to the returned value, it attaches to the
implicit `this` argument.
More information about the Digitalmars-d
mailing list