Clang Bug? Namespace-Template-Klasse 'friend
Der folgende Code, der nicht unter clang kompiliert, sondern unter gcc und VS:
template<typename T> class bar;
namespace NS
{
template<typename T>
class foo
{
foo() {}
template<typename U> friend class bar;
};
}
template<typename R>
class bar
{
public:
bar()
{
NS::foo<int> f;
}
};
int main(int, char **)
{
bar<int> b;
return 0;
}
Es schlägt fehl mit:
main.cpp:20:22: error: calling a private constructor of class 'NS::foo<int>'
NS::foo<int> f;
^
main.cpp:8:9: note: implicitly declared private here
foo() {}
^
bar
sollte Zugriff auf @ habfoo
s privater Konstruktor, aber es sieht so aus, als ob er es nicht tut. Wenn ich @ entfernamespace NS
, es wird kompiliert.
Code sieht für mich gut aus, aber vielleicht verstehe ich den C ++ - Standard falsch. Welcher Compiler ist richtig?