In the following code, I have an item in the initializer list
ExtendHelper<Extender>::Type<> that exactly matches a base class:
ExtendHelper<Extender>::Type<> But the VS2010 compiler complains: error C2614: 'Base::Type<T>::Extend<Extender>' : illegal member initialization: 'Type<Base::Type<Base::Type<Base>::ExtendHelper<Data> >::ExtendHelper<Data> >' is not a base or member.
How can this be?
struct Base { template <class T=Base> struct Type { template <class Extender> struct ExtendHelper { template <class U=ExtendHelper> struct Type : T::Type<U>, Extender { Type(typename T::Type<T> &rhs) : T::Type<U>(rhs) { } Type() {} }; }; template <class Extender> struct Extend : ExtendHelper<Extender>::Type<> { template <class C> Extend(C &rhs) : ExtendHelper<Extender>::Type<>(rhs) { } }; }; }; struct Data { }; Base::Type<Base> base; Base::Type<Base>::Extend<Data> baseWithData(base); Edit: note that I had to add a default constructor to ExtendHelper because the compiler wanted one, but I don't know why.