// RUN: %clang_cc1 -fsyntax-only -verify %s // Template argument deduction with template template parameters. template class A> struct X0 { static const unsigned value = 0; }; template class A> struct X0 { static const unsigned value = 1; }; template struct X0i; template struct X0l; int array_x0a[X0::value == 0? 1 : -1]; int array_x0b[X0::value == 1? 1 : -1]; template struct is_same { static const bool value = false; }; template struct is_same { static const bool value = true; }; template struct allocator { }; template > struct vector {}; // Fun with meta-lambdas! struct _1 {}; struct _2 {}; // Replaces all occurrences of _1 with Arg1 and _2 with Arg2 in T. template struct Replace { typedef T type; }; // Replacement of the whole type. template struct Replace<_1, Arg1, Arg2> { typedef Arg1 type; }; template struct Replace<_2, Arg1, Arg2> { typedef Arg2 type; }; // Replacement through cv-qualifiers template struct Replace { typedef typename Replace::type const type; }; // Replacement of templates template class TT, typename T1, typename Arg1, typename Arg2> struct Replace, Arg1, Arg2> { typedef TT::type> type; }; template class TT, typename T1, typename T2, typename Arg1, typename Arg2> struct Replace, Arg1, Arg2> { typedef TT::type, typename Replace::type> type; }; // Just for kicks... template class TT, typename T1, typename Arg1, typename Arg2> struct Replace, Arg1, Arg2> { typedef TT::type, Arg2> type; }; int array0[is_same::type, int>::value? 1 : -1]; int array1[is_same::type, const int>::value? 1 : -1]; int array2[is_same, int, float>::type, vector >::value? 1 : -1]; int array3[is_same, int, float>::type, vector >::value? 1 : -1]; int array4[is_same, double, float>::type, vector >::value? 1 : -1]; // PR5911 template void f(const T (&a)[N]); int iarr[] = { 1 }; void test_PR5911() { f(iarr); } // Must not examine base classes of incomplete type during template argument // deduction. namespace PR6257 { template struct X { template X(const X& u); }; struct A; void f(A& a); void f(const X& a); void test(A& a) { (void)f(a); } } // PR7463 namespace PR7463 { const int f (); // expected-warning{{type qualifier on return type has no effect}} template void g (T_&); // expected-note{{T_ = int}} void h (void) { g(f()); } // expected-error{{no matching function for call}} }