Ne.app NeANT
The Ne.app NeANT User module of the NeANT distribution.
FRIEND_TEMPLATE.cpp
Go to the documentation of this file.
1// checking for friend templates of templates
2
3
25#include "config.h"
26
27
28template <class T>
29struct A { enum { i }; };
30
31template <class T>
32struct B
33{
34private:
35
36 template <class U, class V>
37 friend int foo (A<U>, B<V>);
38
39 int bar (int i) const { return i; }
40};
41
42template <class T, class U>
43int foo (A<T> a, B<U> b)
44{
45 return b.bar (a.i);
46}
47
48#ifndef _RWSTD_NO_EXPLICIT_FUNC_INSTANTIATION
49
50// explicitly instantiate to detect bugs such as SunPro 5.3's PR #30227
51template int foo (A<int>, B<double>);
52
53#endif // _RWSTD_NO_EXPLICIT_FUNC_INSTANTIATION
54
55int baz ()
56{
57 A<int> a;
59
60 return foo (a, b);
61}
#define i
Definition 17.names.cpp:126
#define a
Definition 17.names.cpp:109
#define b
Definition 17.names.cpp:110
int baz()
#define foo(buf, s,...)
friend int foo(A< U >, B< V >)