The following code:
#include <iostream>
struct A {
using A_int = int; // A_int type declared here
virtual void foo(A_int) = 0;
};
template <typename T>
struct B : public A {
};
template <typename T>
struct C : public B<T> {
void foo(A_int) override {
std::cout << "all good\n";
}
};
int main()
{
C<int> c;
c.foo(1);
}
produces this error:
15:14: error: 'A_int' has not been declared
The same code without the use of templates compiles fine. Could anyone explain why?