G
Guest
I get a C2811 error when I compile the following (with the /clr switch):
template <class T>
ref class Base
{};
template <template <class> class TBase>
ref class Derived
: TBase<int>
{};
error C2811: 'Derived<TBase>' : cannot inherit from 'TBase<int>', a ref
class can only inherit from a ref class or interface class.
However, if I add a self-referential typedef to the Base class and reference
the typedef in the derivation, everything compiles fine:
template <class T>
ref class Base
{
public:
typedef Base Type;
};
template <template <class> class TBase>
ref class Derived
: TBase<int>::Type // this is acceptable
{};
Is this expected behavior?
template <class T>
ref class Base
{};
template <template <class> class TBase>
ref class Derived
: TBase<int>
{};
error C2811: 'Derived<TBase>' : cannot inherit from 'TBase<int>', a ref
class can only inherit from a ref class or interface class.
However, if I add a self-referential typedef to the Base class and reference
the typedef in the derivation, everything compiles fine:
template <class T>
ref class Base
{
public:
typedef Base Type;
};
template <template <class> class TBase>
ref class Derived
: TBase<int>::Type // this is acceptable
{};
Is this expected behavior?