I've accidentally found some weird compilation difference with this code:
namespace test
{
template <typename T>
class A {
T a;
};
}
class B : public test::A<int>
{
friend class A<int>;
};
int main()
{
return 0;
}
GCC and Clang compile this just fine, but MSVC fails with:
error C3856: 'A': symbol is not a class template
error C2628: 'A' followed by 'int' is illegal (did you forget a ';'?)
error C2059: syntax error: '>'
error C2238: unexpected token(s) preceding ';'
I'm kinda confused and wonder which compiler compiles this right?
Tested with:
MSVC: 19.30
GCC: 11.2
Clang: 13.0.0