http://gcc.gnu.org/bugzilla/show_bug.cgi?id=49666
Summary: passing nested function to inline function causes a trampoline call Product: gcc Version: 4.6.0 Status: UNCONFIRMED Severity: enhancement Priority: P3 Component: other AssignedTo: unassig...@gcc.gnu.org ReportedBy: kevin.wa...@gmail.com #include <stdio.h> static inline int identity(int (*f)()) { return f(); } int n = 0; int f() { return n; } int main() { int m = 0; int g() { return m; } printf("%d\n", identity(f)); /* inlines all the way */ printf("%d\n", identity(g)); /* calls g through trampoline */ printf("%d\n", g()); /* inline's g */ }