http://gcc.gnu.org/bugzilla/show_bug.cgi?id=52625
Nikolka <tsoae at mail dot ru> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |tsoae at mail dot ru --- Comment #1 from Nikolka <tsoae at mail dot ru> 2012-03-20 07:34:03 UTC --- G++ issues the same diagnostic message for the following example: template<class> class base {}; class derived : public base<derived> { // error: specialization of 'base<derived>' after instantiation template<class> friend class base<derived>; }; It seems that in the original example g++ incorrectly treats the injected-class-name ::base<derived>::base as template specialization base<derived>, while according to 14.6.1/1 it shall be refer to class template base. Note that g++ does not issue an error in the following case: template<class> class base {}; class derived : public base<derived> { template<class> friend class ::base; }; int main() {}