Commit 3af4c87c by Jason Merrill

new

From-SVN: r35499
parent baf7e33b
// 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;
}
// 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 *-*-*
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment