URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 154 |
Rev 816 |
// { dg-do compile }
|
// { dg-do compile }
|
|
|
// Copyright (C) 2003 Free Software Foundation
|
// Copyright (C) 2003 Free Software Foundation
|
// Contributed by Kriang Lerdsuwanakij
|
// Contributed by Kriang Lerdsuwanakij
|
|
|
// Member function of class template as friend
|
// Member function of class template as friend
|
|
|
template struct A
|
template struct A
|
{
|
{
|
void f(T);
|
void f(T);
|
};
|
};
|
|
|
class C {
|
class C {
|
int i;
|
int i;
|
template friend void A::f(T);
|
template friend void A::f(T);
|
};
|
};
|
|
|
template struct A
|
template struct A
|
{
|
{
|
void f(T*);
|
void f(T*);
|
};
|
};
|
|
|
template<> struct A
|
template<> struct A
|
{
|
{
|
void f(char);
|
void f(char);
|
};
|
};
|
|
|
template void A::f(T)
|
template void A::f(T)
|
{
|
{
|
C c;
|
C c;
|
c.i = 0;
|
c.i = 0;
|
}
|
}
|
|
|
template void A::f(T*)
|
template void A::f(T*)
|
{
|
{
|
C c;
|
C c;
|
c.i = 0;
|
c.i = 0;
|
}
|
}
|
|
|
void A::f(char)
|
void A::f(char)
|
{
|
{
|
C c;
|
C c;
|
c.i = 0;
|
c.i = 0;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
A a1;
|
A a1;
|
a1.f(0);
|
a1.f(0);
|
A a2;
|
A a2;
|
int *p = 0;
|
int *p = 0;
|
a2.f(p);
|
a2.f(p);
|
A a3;
|
A a3;
|
a3.f('a');
|
a3.f('a');
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.