Consider the following C ++ code:
template <class T> class Singleton {}; class ConcreteSingleton : public Singleton<ConcreteSingleton> { template <class T> friend class Singleton; }; int main() {}
Singleton should be a friend of ConcreteSingleton :
It works with Microsoft Visual C ++ compiler. But I can not compile it with g ++ 4.8.4. Error:
error: specialization of 'Singleton<ConcreteSingleton>' after instantiation template <class T> friend class Singleton;
Is there any way to fix this?
source share