https://issues.dlang.org/show_bug.cgi?id=23667
RazvanN <razvan.nitu1...@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1...@gmail.com --- Comment #1 from RazvanN <razvan.nitu1...@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. --