https://issues.dlang.org/show_bug.cgi?id=15671
Stanislav Blinov <[email protected]> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |[email protected] --- Comment #5 from Stanislav Blinov <[email protected]> --- (In reply to Walter Bright from comment #1) > The compiler is using a heuristic of "if the amount of code in a function is > above a certain threshold, then it is not inlined." The idea is that the > overhead of a function call becomes small when the size of the function is > large. Where the code came from is irrelevant. void foo(alias func)() { pragma(inline, true); func(); x = uniform!int(); } The "amount of code" in `foo` (which is explicitly marked by a pragma) is two function calls and a store. After inlining, the void main() { foo!longFunc(); } should become, at the very least void main() { longFunc(); x = uniform!int(); } Yet it fails, presumably because the compiler also attempts to inline `longFunc` and/or `uniform` in `foo` before inlining `foo` itself. --
