How to fix 'incomplete type' error in a circular dependency?
A simplified code of what I have:
template
struct M {
struct V : public X {}; // error: invalid use of incomplete type ‘struct T::U’
struct I {
V* p;
};
// For simplicity assume that V is somehow used
V v;
};
struct T {
struct U {
typename M::I i;
};
M m;
};
So, T::U needs information about M::I, which uses information about M::V, which is constructed from T::U. Is there a way to solve this cycle?