URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Subversion Repositories openrisc
[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [gcc/] [testsuite/] [g++.dg/] [template/] [memfriend3.C] - Rev 801
Go to most recent revision | Compare with Previous | Blame | View Log
// { dg-do compile }
// Copyright (C) 2003 Free Software Foundation
// Contributed by Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
// Member function of class template as friend
template<class T> struct A
{
void f(T);
};
class C {
int i;
template<class T> friend void A<T>::f(T);
};
template<class T> struct A<T*>
{
void f(T*);
};
template<> struct A<char>
{
void f(char);
};
template<class T> void A<T>::f(T)
{
C c;
c.i = 0;
}
template<class T> void A<T*>::f(T*)
{
C c;
c.i = 0;
}
void A<char>::f(char)
{
C c;
c.i = 0;
}
int main()
{
A<int> a1;
a1.f(0);
A<int *> a2;
int *p = 0;
a2.f(p);
A<char> a3;
a3.f('a');
}
Go to most recent revision | Compare with Previous | Blame | View Log