Here's a minimal example I could come up with:
template <typename T>
struct Util
{
using Type = int;
};
struct A
{
struct B : public Util<B> {
void fun(Type) {}
};
};
template <typename T>
struct C
{
struct D : public Util<D> {
void fun(Type) {}
};
};
int main()
{
A::B{}.fun(0);
C<int>::D{}.fun(0);
}
The only difference between A::B
and C::D
is that C
is a template.
Struct C::D
fails to compile with the following error:
test_cpp.cpp:18:18: error: ‘Type’ has not been declared
void fun(Type) {}
^~~~
Why does this fails to compile? How do I make this compile?
Assume that Util is from external library and I cannot change it (it's boost::iterator_facade
if you're courious).