new
From-SVN: r35499
This commit is contained in:
parent
baf7e33b41
commit
3af4c87cca
2 changed files with 56 additions and 0 deletions
44
gcc/testsuite/g++.old-deja/g++.pt/friend44.C
Normal file
44
gcc/testsuite/g++.old-deja/g++.pt/friend44.C
Normal file
|
@ -0,0 +1,44 @@
|
|||
// Test that template friends referring to class template members are
|
||||
// respected.
|
||||
|
||||
// excess errors test - XFAIL *-*-*
|
||||
|
||||
template <class T> struct A
|
||||
{
|
||||
int f (T);
|
||||
struct AI {
|
||||
int f (T);
|
||||
};
|
||||
};
|
||||
|
||||
class B
|
||||
{
|
||||
template <class T> friend int A<T>::f (T);
|
||||
template <class T> friend struct A<T>::AI;
|
||||
int a;
|
||||
public:
|
||||
B(): a(0) { }
|
||||
};
|
||||
|
||||
template <class T> int A<T>::f (T)
|
||||
{
|
||||
B b;
|
||||
return b.a;
|
||||
}
|
||||
|
||||
template <class T> int A<T>::AI::f (T)
|
||||
{
|
||||
B b;
|
||||
return b.a;
|
||||
}
|
||||
|
||||
int main ()
|
||||
{
|
||||
A<int> a;
|
||||
A<int>::AI ai;
|
||||
|
||||
int r = a.f (0);
|
||||
r |= ai.f (0);
|
||||
|
||||
return r;
|
||||
}
|
12
gcc/testsuite/g++.old-deja/g++.pt/overload13.C
Normal file
12
gcc/testsuite/g++.old-deja/g++.pt/overload13.C
Normal file
|
@ -0,0 +1,12 @@
|
|||
// Test that .template limits overload resolution to member templates.
|
||||
|
||||
struct A {
|
||||
template <class T> int f (T) { return 0; }
|
||||
int f (int) { return 1; }
|
||||
};
|
||||
|
||||
int main ()
|
||||
{
|
||||
A a;
|
||||
return a.template f (0); // gets bogus error XFAIL *-*-*
|
||||
}
|
Loading…
Add table
Reference in a new issue