J
Jaroslav Gresula
Consider the following code:
template<class T>
struct Singleton
{
static T& Instance()
{
static T instance;
return instance;
}
};
template<class T>
struct A : public Singleton<A<T> >
{
// causes error C2245
friend A& Singleton<A<T> >::Instance();
};
A<int>& i = A<int>::Instance();
Comeau online is OK with it, VC++ is not.
It is a bug or am I missing something?
Cheers,
Jarda
template<class T>
struct Singleton
{
static T& Instance()
{
static T instance;
return instance;
}
};
template<class T>
struct A : public Singleton<A<T> >
{
// causes error C2245
friend A& Singleton<A<T> >::Instance();
};
A<int>& i = A<int>::Instance();
Comeau online is OK with it, VC++ is not.
It is a bug or am I missing something?
Cheers,
Jarda