[Issue 20245] DIP1000: Should infer scope when taking address of ref

d-bugmail at puremagic.com d-bugmail at puremagic.com
Mon Mar 15 07:35:10 UTC 2021


https://issues.dlang.org/show_bug.cgi?id=20245

moonlightsentinel at disroot.org changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|NEW                         |RESOLVED
                 CC|                            |moonlightsentinel at disroot.o
                   |                            |rg
         Resolution|---                         |WORKSFORME

--- Comment #1 from moonlightsentinel at disroot.org ---
Works fine with current master:

----------------------------------------------
@safe int** foo(ref scope int* x)
{
  int** a = &x;
  return a;
}

@safe int* fooRet(return ref int x)
{
  int* a = &x;
  return a;
}
----------------------------------------------

./generated/linux/release/64/dmd -c -o- -dip1000 dip_escape.d 
dip_escape.d(3): Error: cannot take address of `scope` parameter `x` in `@safe`
function `foo

--


More information about the Digitalmars-d-bugs mailing list