2009-09-09 08:23:06 +08:00
|
|
|
// RUN: clang-cc -fsyntax-only -verify %s
|
|
|
|
|
|
|
|
template<typename U, typename T>
|
|
|
|
U f0(T t) {
|
|
|
|
return t.template get<U>();
|
|
|
|
}
|
|
|
|
|
|
|
|
template<typename U, typename T>
|
|
|
|
int &f1(T t) {
|
|
|
|
// FIXME: When we pretty-print this, we lose the "template" keyword.
|
|
|
|
return t.U::template get<int&>();
|
|
|
|
}
|
|
|
|
|
|
|
|
struct X {
|
|
|
|
template<typename T> T get();
|
|
|
|
};
|
|
|
|
|
|
|
|
void test_f0(X x) {
|
|
|
|
int i = f0<int>(x);
|
|
|
|
int &ir = f0<int&>(x);
|
|
|
|
}
|
|
|
|
|
|
|
|
struct XDerived : public X {
|
|
|
|
};
|
|
|
|
|
|
|
|
void test_f1(XDerived xd) {
|
2009-10-20 13:58:46 +08:00
|
|
|
int &ir = f1<X>(xd);
|
2009-09-09 08:23:06 +08:00
|
|
|
}
|
|
|
|
|
2009-10-20 06:04:39 +08:00
|
|
|
// PR5213
|
|
|
|
template <class T>
|
|
|
|
struct A {};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
class B
|
|
|
|
{
|
|
|
|
A<T> a_;
|
|
|
|
|
|
|
|
public:
|
|
|
|
void destroy();
|
|
|
|
};
|
|
|
|
|
|
|
|
template<class T>
|
|
|
|
void
|
|
|
|
B<T>::destroy()
|
|
|
|
{
|
|
|
|
a_.~A<T>();
|
|
|
|
}
|
|
|
|
|
|
|
|
void do_destroy_B(B<int> b) {
|
|
|
|
b.destroy();
|
|
|
|
}
|