The following code which doesn\'t compile under clang but does under gcc and VS:
template class bar;
namespace NS
{
template
Changing the code to
template class bar;
namespace NS
{
template
class foo
{
foo() {}
template friend class ::bar;
};
}
template
class bar
{
public:
bar()
{
NS::foo f;
}
};
int main(int, char **)
{
bar b;
return 0;
}
compiles with clang. The problem seems to be the namespace lookup. The code
template friend class bar;
actually declared the class NS::bar a friend of NS::foo, so foo should not have been affected. My guess would be that clang is standard conformant and the code should not compile.