https://gcc.gnu.org/bugzilla/show_bug.cgi?id=42328
--- Comment #9 from Richard Smith <richard-gccbugzilla at metafoo dot co.uk> ---
Yes, I think this is ill-formed (although the standard is very unclear about
this). I think the declaration
template<typename T> friend void freeList<T, baz>::foo();
would declare the member 'foo' of the class template partial specialization
freeList<T, baz> to be a friend, but no such partial specialization has been
defined. If I add
class baz;
template<typename T> class freeList<T, baz> { void foo(); };
before the definition of 'baz', then GCC and EDG accept, which I think is
correct behavior.