Mercurial > hg > CbC > CbC_gcc
comparison gcc/testsuite/g++.dg/template/friend23.C @ 111:04ced10e8804
gcc 7
author | kono |
---|---|
date | Fri, 27 Oct 2017 22:46:09 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
68:561a7518be6b | 111:04ced10e8804 |
---|---|
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; | |
14 inline A() : _data(0) {} | |
15 template <typename U> | |
16 inline A(const A<U>& r) : _data(r._data) {} | |
17 }; | |
18 | |
19 class B : public A<int> | |
20 { | |
21 public: | |
22 inline B() {} | |
23 inline B(const B& r) : A<int>(r) {} | |
24 }; | |
25 | |
26 class C : public A<float> | |
27 { | |
28 public: | |
29 inline C() {} | |
30 inline C(const B& r) : A<float>(r) {} | |
31 }; | |
32 | |
33 int main(int, char*[]) | |
34 { | |
35 B b1, b2(b1); | |
36 C c(b1); | |
37 return 0; | |
38 } |