// RUN: %clang_cc1 -fsyntax-only -verify %s template U f0(T t) { return t.template get(); } template int &f1(T t) { // FIXME: When we pretty-print this, we lose the "template" keyword. return t.U::template get(); } struct X { template T get(); }; void test_f0(X x) { int i = f0(x); int &ir = f0(x); } struct XDerived : public X { }; void test_f1(XDerived xd) { int &ir = f1(xd); } // PR5213 template struct A {}; template class B { A a_; public: void destroy(); }; template void B::destroy() { a_.~A(); } void do_destroy_B(B b) { b.destroy(); } struct X1 { int* f1(int); template float* f1(T); static int* f2(int); template static float* f2(T); }; void test_X1(X1 x1) { float *fp1 = x1.f1<>(17); float *fp2 = x1.f1(3.14); // expected-warning {{implicit conversion from 'double' to 'int' changes value from 3.14 to 3}} int *ip1 = x1.f1(17); float *ip2 = x1.f1(3.14); float* (X1::*mf1)(int) = &X1::f1; float* (X1::*mf2)(int) = &X1::f1<>; float* (X1::*mf3)(float) = &X1::f1; float* (*fp3)(int) = &X1::f2; float* (*fp4)(int) = &X1::f2<>; float* (*fp5)(float) = &X1::f2; float* (*fp6)(int) = X1::f2; float* (*fp7)(int) = X1::f2<>; float* (*fp8)(float) = X1::f2; } template struct X2 { int m; }; template struct X3 : T { }; template struct X4 { template void f(X2().U::m)>); }; void f(X4 > x4i) { X2 x2; x4i.f >(x2); } template struct X5 { template void f(); void g() { this->f(); } }; namespace PR6021 { template< class T1, class T2 > class Outer { public: // Range operations template< class X > X tmpl( const X* = 0 ) const; struct Inner { const Outer& o; template< class X > operator X() const { return o.tmpl(); } }; }; } namespace rdar8198511 { template struct Base { void f(); }; template struct X0 : Base<1, T> { }; template struct X1 { X0 x0; void f() { this->x0.Base<1, int>::f(); } }; }