Bug 15159 – Static nested function prevent inlining

Status
NEW
Severity
enhancement
Priority
P4
Component
dmd
Product
D
Version
D2
Platform
x86_64
OS
All
Creation time
2015-10-05T10:37:19Z
Last change time
2024-12-13T18:45:06Z
Assigned to
No Owner
Creator
Dmitry Olshansky
Moved to GitHub: dmd#19054 →

Comments

Comment #0 by dmitry.olsh — 2015-10-05T10:37:19Z
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); }
Comment #1 by thomas.bockman — 2015-12-29T17:42:20Z
Comment #2 by robert.schadek — 2024-12-13T18:45:06Z
THIS ISSUE HAS BEEN MOVED TO GITHUB https://github.com/dlang/dmd/issues/19054 DO NOT COMMENT HERE ANYMORE, NOBODY WILL SEE IT, THIS ISSUE HAS BEEN MOVED TO GITHUB