D-Programming-Language/dmd — pull request #1551 by donc (2013-01-25 09:18:29+00:00)
Title: 1841 Closure detection fails in nested functions

If an escaping function doesn't use any closure variables itself, but is ultimately calls another nested function which does, it must be marked as needing a closure.

This 'calling a sibling nested function' case was missing. I've fixed this by constructing a simple call graph for nested functions. Note that nested functions cannot be forward referenced by other nested functions, so the call graph is a simple tree, with no cycles, and that makes it trivial to traverse.