https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109942

--- Comment #1 from Jonathan Wakely <redi at gcc dot gnu.org> ---
I think it's debatable whether GCC's behaviour is incorrect. The definition of
the function template can be seen, and no explicit specialization has been
declared for foo<int>, so the compiler is allowed to inline the definition.

It *has* to instantiate it the definition, to determine the return type. Since
it has to instantiate it anyway, it might as well inline it as well.

So even if this failed to link, you wouldn't get faster compile times because
the definition must be instantiated anyway.

Reply via email to