diff options
Diffstat (limited to 'test/SemaTemplate/friend-template.cpp')
-rw-r--r-- | test/SemaTemplate/friend-template.cpp | 80 |
1 files changed, 80 insertions, 0 deletions
diff --git a/test/SemaTemplate/friend-template.cpp b/test/SemaTemplate/friend-template.cpp index 6ee30aa7775a5..1d62804f68acc 100644 --- a/test/SemaTemplate/friend-template.cpp +++ b/test/SemaTemplate/friend-template.cpp @@ -127,3 +127,83 @@ namespace PR6022 { }; } +namespace FriendTemplateDefinition { + template<unsigned > struct int_c { }; + + template<typename T> + struct X { + template<unsigned N> + friend void f(X, int_c<N>) { + int value = N; + }; + }; + + void test_X(X<int> x, int_c<5> i5) { + f(x, i5); + } +} + +namespace PR7013a { + template<class > struct X0 + { + typedef int type; + }; + template<typename > struct X1 + { + }; + template<typename , typename T> struct X2 + { + typename T::type e; + }; + namespace N + { + template <typename = int, typename = X1<int> > struct X3 + { + template <typename T1, typename T2, typename B> friend void op(X2<T1, T2>& , B); + }; + template <typename Ch, typename Tr, typename B> void op(X2<Ch, Tr>& , B) + { + X2<int, Tr> s; + } + } + int n() + { + X2<int, X0<int> > ngs; + N::X3<> b; + op(ngs, b); + return 0; + } +} + +namespace PR7013b { + template<class > struct X0 + { + typedef int type; + }; + template<typename > struct X1 + { + }; + template<typename , typename T> struct X2 + { + typename T::type e; + }; + namespace N + { + template <typename = X1<int> > struct X3 + { + template <typename T1, typename T2, typename B> friend void op(X2<T1, T2>& , B); + }; + template <typename Ch, typename Tr, typename B> void op(X2<Ch, Tr>& , B) + { + X2<int, Tr> s; + } + } + int n() + { + X2<int, X0<int> > ngs; + N::X3<> b; + op(ngs, b); + return 0; + } + +} |