https://issues.dlang.org/show_bug.cgi?id=16193
--- Comment #4 from Marc Schütz <schue...@gmx.net> --- (In reply to Steven Schveighoffer from comment #3) > (In reply to Marc Schütz from comment #0) > > I'm deliberately using separate compilation here to > > make sure that the compiler has no way to infer that the closure doesn't > > escape. > > Separate compilation doesn't imply anything. The compiler can see all the > source for opApply, so it could potentially make the decision that it > doesn't escape. > Because of separate compilation, the compiler IMO _must not_ rely on the implementation details of the called function, it may only use the information available in the function signature. That's my understanding, at least: attribute inference must only happen for template and auto functions. Inlining is probably an exception, but I didn't enable that in this example. --