On 12/9/14 9:23 AM, Nick Treleaven wrote:
On 08/12/2014 15:53, Steven Schveighoffer wrote:
   scope ref int foo(ref int x);

will do it.

So:

int x;

foo(x) += 1;

will compile?

Yes, because foo's argument is not scope, it can be returned.

But I thought if you take a reference from the stack, it's inferred as scope? I feel like there's a missing link somewhere if the scope is missing from the parameter.

Will ref just automatically bind to any scoped reference?

What about this:

auto y = &x;

foo(*y) += 1;

-Steve

Reply via email to