URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Only display areas with differences |
Details |
Blame |
View Log
Rev 305 |
Rev 338 |
// { dg-do compile }
|
// { dg-do compile }
|
// Test that template friends referring to class template members are
|
// Test that template friends referring to class template members are
|
// respected.
|
// respected.
|
|
|
|
|
template struct A
|
template struct A
|
{
|
{
|
int f (T);
|
int f (T);
|
struct AI {
|
struct AI {
|
int f (T);
|
int f (T);
|
};
|
};
|
};
|
};
|
|
|
class B
|
class B
|
{
|
{
|
template friend int A::f (T);
|
template friend int A::f (T);
|
template friend struct A::AI;
|
template friend struct A::AI;
|
int a;
|
int a;
|
public:
|
public:
|
B(): a(0) { }
|
B(): a(0) { }
|
};
|
};
|
|
|
template int A::f (T)
|
template int A::f (T)
|
{
|
{
|
B b;
|
B b;
|
return b.a;
|
return b.a;
|
}
|
}
|
|
|
template int A::AI::f (T)
|
template int A::AI::f (T)
|
{
|
{
|
B b;
|
B b;
|
return b.a;
|
return b.a;
|
}
|
}
|
|
|
int main ()
|
int main ()
|
{
|
{
|
A a;
|
A a;
|
A::AI ai;
|
A::AI ai;
|
|
|
int r = a.f (0);
|
int r = a.f (0);
|
r |= ai.f (0);
|
r |= ai.f (0);
|
|
|
return r;
|
return r;
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.