// RUN: clang-cc -fsyntax-only -verify %s // PR5057 namespace test0 { namespace std { class X { public: template friend struct Y; }; } namespace std { template struct Y {}; } } namespace test1 { template void f1(T) { } // expected-note{{here}} class X { template friend void f0(T); template friend void f1(T); }; template void f0(T) { } template void f1(T) { } // expected-error{{redefinition}} } // PR4768 namespace test2 { template struct X0 { template friend struct X0; }; template struct X0 { template friend struct X0; }; template<> struct X0 { template friend struct X0; }; template struct X1 { template friend void f2(U); template friend void f3(U); }; template void f2(U); X1 x1i; X0 x0ip; template<> void f2(int); // FIXME: Should this declaration of f3 be required for the specialization of // f3 (further below) to work? GCC and EDG don't require it, we do... template void f3(U); template<> void f3(int); } // PR5332 namespace test3 { template class Foo { template friend class Foo; }; Foo foo; template struct X2a; template struct X2b; template class X3 { template friend struct X2a; template friend struct X2b; }; X3 x3i; // okay X3 x3l; // FIXME: should cause an instantiation-time failure } // PR5716 namespace test4 { template struct A { template friend void f(const A&); }; template void f(const A&) { int a[sizeof(T) ? -1 : -1]; // expected-error {{array size is negative}} } void f() { f(A()); // expected-note {{in instantiation of function template specialization}} } }