From-SVN: r35499
This commit is contained in:
Jason Merrill 2000-08-04 20:38:31 -04:00
parent baf7e33b41
commit 3af4c87cca
2 changed files with 56 additions and 0 deletions

View 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;
}

View 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 *-*-*
}