GCC doesn't normally emit code for inline functions (at high optimization levels). Because inline functions, by intent, should be inlined into their callers, and there's no purpose in keeping their code in object files.
However, this is not required by C++ standard. What C++ standard requires is that function pointers can point to any function, including those inline! But function pointers have a concrete representation in GCC, and it's a pointer to a physical loaction. This means, that to use a pointer to an inline function, it should have a specific address.
So, to get address of an inline function you should, ehm... get its address in the code! This will make compiler instantiate the inline function and emit assembler code for it. And there are more ways to emit their bodies. See GCC docs:
... Some calls [to inline functions] cannot be integrated for various reasons (in particular, calls that precede the function's definition cannot be integrated, and neither can recursive calls within the definition). If there is a nonintegrated call, then the function is compiled to assembler code as usual. The function must also be compiled as usual if the program refers to its address, because that can't be inlined.
Here's a piece code that confirms this:
inline int uiopuiop()
{
return 4;
}
typedef int (*fptr)();
int main()
{
fptr f = uiopuiop;
return uiopuiop();
}
If you compile C code, you can also use -fkeep-inline-functions
for static-inline
functions.