// RUN: %clang_cc1 -std=c++11 -fsyntax-only -verify %s template struct tuple; template struct unsigned_c; template struct is_same { static const bool value = false; }; template struct is_same { static const bool value = true; }; namespace PackExpansionNotAtEnd { template struct tuple_same_with_int { static const bool value = false; }; template struct tuple_same_with_int, tuple> { static const bool value = true; }; int tuple_same_with_int_1[tuple_same_with_int, tuple >::value? 1 : -1]; template struct UselessPartialSpec; template // expected-note{{non-deducible template parameter 'Tail'}} struct UselessPartialSpec; // expected-error{{class template partial specialization contains template parameters that cannot be deduced; this partial specialization will never be used}} } // When a pack expansion occurs within a template argument list, the entire // list is a non-deduced context. For the corresponding case in a function // parameter list, only that parameter is non-deduced. // // FIXME: It's not clear that this difference is intended, but the wording is // explicit. namespace PackExpansionNotAtEndFunctionVersusTemplate { template struct X {}; template void f1(void(T..., U)); // expected-note@+1 {{couldn't infer template argument 'U'}} template void f2(X); // FIXME: ill-formed, U is not deducible void g(int, int, int); X h; void test() { // This is deducible: the T... parameter is a non-deduced context, but // that's OK because we don't need to deduce it. f1(g); // This is not deducible: the T... parameter renders the entire // template-argument-list a non-deduced context, so U is not deducible. f2(h); // expected-error {{no matching function}} } template struct Y; template struct Y {}; // expected-error {{cannot be deduced}} template // expected-note {{non-deducible template parameter 'U'}} struct Y>; // expected-error {{cannot be deduced}} // FIXME: T is not deducible here, due to [temp.deduct.call]p1: // "When a function parameter pack appears in a non-deduced context, // the type of that pack is never deduced." template struct Y {}; } namespace DeduceNonTypeTemplateArgsInArray { template struct split_arrays; template struct split_arrays { typedef tuple element_types; // FIXME: Would like to have unsigned_tuple here. typedef tuple...> bounds_types; }; int check1[is_same::element_types, tuple>::value? 1 : -1]; int check2[is_same::bounds_types, tuple, unsigned_c<2>, unsigned_c<3>> >::value? 1 : -1]; } namespace DeduceWithDefaultArgs { template class Container> void f(Container); // expected-note {{deduced type 'X<[...], (default) int>' of 1st parameter does not match adjusted type 'X<[...], double>' of argument [with Container = X]}} template struct X {}; void g() { // OK, use default argument for the second template parameter. f(X{}); f(X{}); // Not OK. f(X{}); // expected-error {{no matching function for call to 'f'}} } }