// 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) { (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); }; }