digitalmars.D.bugs - [Issue 15159] New: Static nested function prevent inlining
- via Digitalmars-d-bugs (42/42) Oct 05 2015 https://issues.dlang.org/show_bug.cgi?id=15159
https://issues.dlang.org/show_bug.cgi?id=15159 Issue ID: 15159 Summary: Static nested function prevent inlining Product: D Version: D2 Hardware: x86_64 OS: All Status: NEW Severity: enhancement Priority: P1 Component: dmd Assignee: nobody puremagic.com Reporter: dmitry.olsh gmail.com Turns out that even _static_ nested function prevents inlining. Testing on DMD-v2.069 HEAD. Test case: int boo() { pragma(inline, true); static int foo(int k){ return k; } return foo(1); } // needed else it will ignore inliner pass unittest { assert(boo() == 1); } fails: .\boo.d(1): Error: function boo.boo cannot inline function While this works: static int foo(int k){ return k; } int boo() { pragma(inline, true); return foo(1); } // needed else it will ignore inliner pass unittest { assert(boo() == 1); } --
Oct 05 2015