https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66132
Bug ID: 66132 Summary: Undefined reference to inline function Product: gcc Version: 5.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c Assignee: unassigned at gcc dot gnu.org Reporter: shea at shealevy dot com Target Milestone: --- When compiling with the default optimization level, this code: inline int foo() { return 1; } int main(int argc, char ** argv) { return foo(); } results in an undefined reference error: /tmp/ccRBjwvf.o: In function `main': test.c:(.text+0x15): undefined reference to `foo' collect2: error: ld returned 1 exit status This goes away at -O2 (presumably because the function is actually inlined?)