https://issues.dlang.org/show_bug.cgi?id=23112
--- Comment #6 from Walter Bright <[email protected]> --- Regarding `f` as escaping produces far too many false positives. 1. semantic3 (the function body) analysis is done for a function. No gc use is found, and no escapes of an aliased reference are found, so the function is inferred @nogc. This also enables some NRVO optimizations. 2. code is generated that depends on the @nogc inferred attribute of the function, and/or does NRVO. 3. code is generated via another template getting expanded that escapes the alias reference. 4. this gets detected by the code the decides whether to generate a closure or not, and now (2) is invalid, but it's too late. --
