111
|
1 // { dg-do compile }
|
|
2
|
|
3 namespace boost_no_member_template_friends{
|
|
4
|
|
5 template <class T>
|
|
6 class foobar;
|
|
7
|
|
8 template <class T>
|
|
9 class foo
|
|
10 {
|
|
11 private:
|
|
12 template<typename Y> friend class foobar;
|
|
13 template<typename Y> friend class foo;
|
|
14 template<typename Y> friend bool must_be_friend_proc(const foo<Y>& f);
|
|
15 int i;
|
|
16 public:
|
|
17 foo(){ i = 0; }
|
|
18 template <class U>
|
|
19 foo(const foo<U>& f){ i = f.i; }
|
|
20 };
|
|
21
|
|
22 template <class T>
|
|
23 class foo;
|
|
24
|
|
25 template <class T>
|
|
26 bool must_be_friend_proc(const foo<T>& f);
|
|
27
|
|
28 template <class T>
|
|
29 bool must_be_friend_proc(const foo<T>& f)
|
|
30 { return f.i != 0; }
|
|
31
|
|
32 template <class T>
|
|
33 class foobar
|
|
34 {
|
|
35 int i;
|
|
36 public:
|
|
37 template <class U>
|
|
38 foobar(const foo<U>& f)
|
|
39 { i = f.i; }
|
|
40 };
|
|
41
|
|
42
|
|
43 int test()
|
|
44 {
|
|
45 foo<int> fi;
|
|
46 foo<double> fd(fi);
|
|
47 (void) &fd; // avoid "unused variable" warning
|
|
48 foobar<long> fb(fi);
|
|
49 (void) &fb; // avoid "unused variable" warning
|
|
50 return 0;
|
|
51 }
|
|
52
|
|
53 }
|