2009-09-28 08:08:27 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
2009-09-26 14:47:28 +08:00
|
|
|
|
|
|
|
// PR5057
|
|
|
|
namespace std {
|
|
|
|
class X {
|
|
|
|
public:
|
|
|
|
template<typename T>
|
|
|
|
friend struct Y;
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
namespace std {
|
|
|
|
template<typename T>
|
|
|
|
struct Y
|
|
|
|
{
|
|
|
|
};
|
|
|
|
}
|
2009-09-28 08:08:27 +08:00
|
|
|
|
|
|
|
|
|
|
|
namespace N {
|
|
|
|
template<typename T> void f1(T) { } // expected-note{{here}}
|
|
|
|
|
|
|
|
class X {
|
|
|
|
template<typename T> friend void f0(T);
|
|
|
|
template<typename T> friend void f1(T);
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T> void f0(T) { }
|
|
|
|
template<typename T> void f1(T) { } // expected-error{{redefinition}}
|
|
|
|
}
|
2009-10-10 05:11:42 +08:00
|
|
|
|
|
|
|
// PR4768
|
|
|
|
template<typename T>
|
|
|
|
struct X0 {
|
|
|
|
template<typename U> friend struct X0;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct X0<T*> {
|
|
|
|
template<typename U> friend struct X0;
|
|
|
|
};
|
|
|
|
|
|
|
|
template<>
|
|
|
|
struct X0<int> {
|
|
|
|
template<typename U> friend struct X0;
|
|
|
|
};
|
2009-10-13 22:39:41 +08:00
|
|
|
|
|
|
|
template<typename T>
|
|
|
|
struct X1 {
|
|
|
|
template<typename U> friend void f2(U);
|
|
|
|
template<typename U> friend void f3(U);
|
|
|
|
};
|
|
|
|
|
|
|
|
template<typename U> void f2(U);
|
|
|
|
|
|
|
|
X1<int> x1i;
|
|
|
|
|
|
|
|
template<> void f2(int);
|
|
|
|
|
|
|
|
// FIXME: Should this declaration of f3 be required for the specialization of
|
|
|
|
// f3<int> (further below) to work? GCC and EDG don't require it, we do...
|
|
|
|
template<typename U> void f3(U);
|
|
|
|
|
|
|
|
template<> void f3(int);
|