On Wednesday, 10 April 2013 at 04:46:43 UTC, Zach the Mystic wrote:
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!
}

Reply via email to