With GCC, we can't access the member in the base class without writing this
explicitly, but it works on MSVC, what is going on? Is it because of the CRTP?
#include <iostream>
template<class T>
struct Base {
protected:
T* a;
};
template<class U>
struct Derived : Base<Derived<U>> {
void print_a() {
std::cout << a << std::endl; // doesn't work on GCC
std::cout << this->a << std::endl; // works on GCC
}
};
int main() {
Derived<float> d;
d.print_a();
}