template <typename T>
class Foo{
private:
class Bar{
};
};
template <typename T>
void Fun(const Foo<T> &f){
Foo<int>::Bar b; //This line of code.
}
int main(){
Foo<int> f;
Fun(f);
return 0;
}
g++ can compile it with no error while Clang points out that Foo<int>::Bar
is inaccessiable.
g++: https://wandbox.org/permlink/9scQUmfVLQU6IM0J
Clang: https://wandbox.org/permlink/dQm9VcsZURbjxrFZ
What's wrong with g++? I trusted it so much. Should I use Clang for learning instead?