http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56328
--- Comment #5 from Michael Schlottke <michael.schlottke at sloede dot com> 2013-02-15 08:05:39 UTC --- (In reply to comment #3) > Also, [basic.def.odr]: "An inline function shall be defined in every > translation unit in which it is odr-used." and [dcl.fct.spec] "If a function > with external linkage is declared inline in one translation unit, it shall be > declared inline in all translation units in which it appears; no diagnostic is > required." > > To fix the program you need to declare the explicit specialization in main.cpp > and neither foo<T> nor foo<2> can be inline unless they're defined in both > translation units. I fully agree. But why is there a difference then between the base template and the specialization? I am not arguing that the specialized template should work when declared inline, I am questioning the fact that the behavior is different for specialized and non-specialized templates, and I could not find an explanation in the standard.