http://gcc.gnu.org/bugzilla/show_bug.cgi?id=59475
--- Comment #5 from Akela1101 <akela1101 at gmail dot com> --- I see... So, at -O1 in main.o the function is inline, and in A.o it has outer implementation. At -O0 in both TU, not inline function is using. The thing was not template specialization, but processing inline functions. Sorry, I didn't know linker even had no warnings like "multiple definition" for inline functions, e.g.: TU 1: int foo() { return 1; } TU 2: inline int foo() { return 2; }