ref int bar(ref int x) { return x; } ref int foo(scope ref int x) { int* y = new int; *y = x; return y; }ref int test() { return foo(1); // allowed return bar(1); // disallowed! }
When said 'bar(1)' was disallowed, I meant that it was considered local and not disallowed because it doesn't accept rvalue temps. Fix:
ref int test() {
int y;
return foo(y); // allowed
return bar(y); // disallowed!
}
