URL
https://opencores.org/ocsvn/openrisc/openrisc/trunk
Go to most recent revision |
Only display areas with differences |
Details |
Blame |
View Log
Rev 149 |
Rev 154 |
// { dg-do compile }
|
// { dg-do compile }
|
|
|
// Copyright (C) 2004 Free Software Foundation
|
// Copyright (C) 2004 Free Software Foundation
|
// Contributed by Kriang Lerdsuwanakij
|
// Contributed by Kriang Lerdsuwanakij
|
|
|
// Nested class of class template as friend
|
// Nested class of class template as friend
|
|
|
template struct A
|
template struct A
|
{
|
{
|
struct B
|
struct B
|
{
|
{
|
void f();
|
void f();
|
};
|
};
|
};
|
};
|
|
|
template class C {
|
template class C {
|
int i;
|
int i;
|
template friend struct A::B;
|
template friend struct A::B;
|
};
|
};
|
|
|
template struct A
|
template struct A
|
{
|
{
|
struct B
|
struct B
|
{
|
{
|
void f();
|
void f();
|
};
|
};
|
};
|
};
|
|
|
template<> struct A
|
template<> struct A
|
{
|
{
|
struct B
|
struct B
|
{
|
{
|
void f();
|
void f();
|
};
|
};
|
};
|
};
|
|
|
template void A::B::f()
|
template void A::B::f()
|
{
|
{
|
C c;
|
C c;
|
c.i = 0;
|
c.i = 0;
|
}
|
}
|
|
|
template void A::B::f()
|
template void A::B::f()
|
{
|
{
|
C c;
|
C c;
|
c.i = 0;
|
c.i = 0;
|
}
|
}
|
|
|
void A::B::f()
|
void A::B::f()
|
{
|
{
|
C c;
|
C c;
|
c.i = 0;
|
c.i = 0;
|
}
|
}
|
|
|
int main()
|
int main()
|
{
|
{
|
A::B b1;
|
A::B b1;
|
b1.f();
|
b1.f();
|
A::B b2;
|
A::B b2;
|
b2.f();
|
b2.f();
|
A::B b3;
|
A::B b3;
|
b3.f();
|
b3.f();
|
}
|
}
|
|
|
© copyright 1999-2024
OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.