// RUN: %clang_cc1 -fsyntax-only -verify %s template struct X0 { template T f0(U); template U& f1(T*, U); // expected-error{{pointer to a reference}} \ // expected-note{{candidate}} }; X0 x0i; X0 x0v; X0 x0ir; // expected-note{{instantiation}} void test_X0(int *ip, double *dp) { X0 xi; int i1 = xi.f0(ip); double *&dpr = xi.f1(ip, dp); xi.f1(dp, dp); // expected-error{{no matching}} X0 xv; double *&dpr2 = xv.f1(ip, dp); } template struct X1 { template struct Inner0 { U x; T y; // expected-error{{void}} }; template struct Inner1 { U x; // expected-error{{void}} T y; }; template struct Inner2 { struct SuperInner { U z; // expected-error{{void}} }; }; template struct Inner3 { void f0(T t, U u) { // expected-note{{passing argument to parameter 't' here}} (void)(t + u); // expected-error{{invalid operands}} } template V f1(T t, U u, V) { return t + u; // expected-error{{cannot initialize return object}} } }; template struct Inner4; }; template template struct X1::Inner4 { template V f2(T t, U u, V); static U value; }; template template U X1::Inner4::value; // expected-error{{reference variable}} template template template V X1::Inner4::f2(T t, U u, V) { return t + u; // expected-error{{cannot initialize return object}} } void test_X1(int *ip, int i, double *dp) { X1::Inner0 *xvip; // okay X1::Inner0 xvi; // expected-note{{instantiation}} X1::Inner1 *xivp; // okay X1::Inner1 xiv; // expected-note{{instantiation}} X1::Inner2::SuperInner *xisivp; // okay X1::Inner2::SuperInner xisiv; // expected-note{{instantiation}} X1::Inner3 id3; id3.f0(ip, i); id3.f0(dp, i); // expected-error{{cannot initialize a parameter of type 'int *' with an lvalue of type 'double *'}} id3.f1(ip, i, ip); id3.f1(ip, i, dp); // expected-note{{instantiation}} X1::Inner3 id3b; id3b.f0(ip, dp); // expected-note{{instantiation}} X1::Inner4 id4; id4.f2(ip, i, dp); // expected-note{{instantiation}} X1::Inner4::value = 17; i = X1::Inner4::value; // expected-note{{instantiation}} } template struct X2 { template // expected-error{{pointer to a reference}} struct Inner; template // expected-error{{cannot have type 'float'}} struct Inner2; }; X2 x2a; // expected-note{{instantiation}} X2 x2b; // expected-note{{instantiation}} namespace N0 { template struct X0 { }; struct X1 { template void f(X0& vals) { g(vals); } template void g(X0& vals) { } }; void test(X1 x1, X0 x0i, X0 x0l) { x1.f(x0i); x1.f(x0l); } } namespace PR6239 { template struct X0 { class type { typedef T E; template // subsitute T for E and bug goes away struct sfinae { }; template typename sfinae<&U::operator=>::type test(int); }; }; template struct X1 { typedef T E; template // subsitute T for E and bug goes away struct sfinae { }; template typename sfinae<&U::operator=>::type test(int); }; } namespace PR7587 { template class X0; template struct X1; template class X2; template class X3 { template< template class TT, typename U = typename X1::type > struct Inner { typedef X2::type> > Type; }; const typename Inner::Type minCoeff() const; }; template class X3 { template< template class TT, typename U = typename X1::type > struct Inner { typedef X2::type> > Type; }; const typename Inner::Type minCoeff() const; }; } namespace PR7669 { template struct X { template struct Y { template struct Z; template struct Z {}; }; }; void a() { X::Y::Z<0,int>(); } } namespace PR8489 { template class C { template void F() {} // expected-note{{FT}} }; void f() { C c; c.F(); // expected-error{{no matching member function}} } } namespace rdar8986308 { template struct __static_assert_test; template <> struct __static_assert_test {}; template struct __static_assert_check {}; namespace std { template struct __has_rebind { private: struct __two {char _; char __;}; template static __two __test(...); template static char __test(typename _Xp::template rebind<_Up>* = 0); public: static const bool value = sizeof(__test<_Tp>(0)) == 1; }; } template struct B1 {}; template struct B { template struct rebind {typedef B1 other;}; }; template struct D1 {}; template struct D { template struct rebind {typedef D1 other;}; }; int main() { typedef __static_assert_check, double>::value))>)> __t64; typedef __static_assert_check, double>::value))>)> __t64; } }