1 // { dg-do compile } 2 3 // Origin: Alexandre Tolmos <ktulu@free.fr> 4 5 // PR c++/11876: Friend of its own class diagnostics 6 7 template <typename T> 8 class A 9 { 10 friend class A<int>; 11 friend class A<float>; 12 protected: 13 T _data; A()14 inline A() : _data(0) {} 15 template <typename U> A(const A<U> & r)16 inline A(const A<U>& r) : _data(r._data) {} 17 }; 18 19 class B : public A<int> 20 { 21 public: B()22 inline B() {} B(const B & r)23 inline B(const B& r) : A<int>(r) {} 24 }; 25 26 class C : public A<float> 27 { 28 public: C()29 inline C() {} C(const B & r)30 inline C(const B& r) : A<float>(r) {} 31 }; 32 main(int,char * [])33int main(int, char*[]) 34 { 35 B b1, b2(b1); 36 C c(b1); 37 return 0; 38 } 39