[Issue 23667] [REG2.101] Incorrect escape deprecation on scope lazy pointer parameter
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Fri Feb 3 10:53:20 UTC 2023
https://issues.dlang.org/show_bug.cgi?id=23667
RazvanN <razvan.nitu1305 at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |razvan.nitu1305 at gmail.com
--- Comment #1 from RazvanN <razvan.nitu1305 at gmail.com> ---
The compiler essentially rewrites the code to:
```
struct S
{
this(ref int i)
{
DBG(() => &i);
}
}
void DBG(scope int* delegate() args) {}
```
So it essentially attaches scope to args no to the return type of args (as far
as I understand it doesn't make sense to attach scope on a return type),
therefore the scoping information is lost and the compiler is conservative and
doesn't let you do that.
I guess the compiler should first perform escape analysis before lowering i to
a delegate.
--
More information about the Digitalmars-d-bugs
mailing list