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