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