2016-12-21 Jason Merrill <jason@redhat.com>
+ * pt.c (coerce_template_parms): Consider variadic_args_p before
+ complaining about too many template arguments.
+
* pt.c (process_partial_specialization): Use
get_partial_spec_bindings to check that the partial specialization
is more specialized than the primary template.
variadic_args_p = pack_expansion_args_count (inner_args);
nargs = inner_args ? NUM_TMPL_ARGS (inner_args) : 0;
- if ((nargs > nparms && !variadic_p)
+ if ((nargs - variadic_args_p > nparms && !variadic_p)
|| (nargs < nparms - variadic_p
&& require_all_args
&& !variadic_args_p
--- /dev/null
+// Test that passing a non-variadic template to a variadic TTP works
+// with explicit template arguments in a function call..
+// { dg-do compile { target c++11 } }
+
+template<template<typename> class Property, typename Type>
+bool test_property(typename Property<Type>::value_type value);
+
+template<template<typename...> class Property,
+ typename Type1, typename... Types>
+bool test_property(typename Property<Type1, Types...>::value_type value);
+
+template <class T>
+struct X
+{
+ using type = X;
+ using value_type = int;
+ static const value_type value = 42;
+};
+
+int main()
+{
+ test_property<X,int>(42); // { dg-error "ambiguous" }
+}
--- /dev/null
+// Test that passing a non-variadic template to a variadic TTP works
+// with explicit template arguments in a function call..
+// { dg-do compile { target c++11 } }
+
+template<template<typename...> class Property,
+ typename Type1, typename... Types>
+bool test_property(typename Property<Type1, Types...>::value_type value);
+
+template <class T>
+struct X
+{
+ using type = X;
+ using value_type = int;
+ static const value_type value = 42;
+};
+
+int main()
+{
+ test_property<X,int>(42);
+}
+2016-12-16 Jason Merrill <jason@redhat.com>
+
+ * testsuite/util/testsuite_tr1.h (test_property): Don't define both
+ variadic and non-variadic overloads.
+
2016-12-21 Jonathan Wakely <jwakely@redhat.com>
PR libstdc++/71444
&& Category<const volatile Type>::type::value == value);
}
- template<template<typename> class Property, typename Type>
-#if __cplusplus >= 201103L
- constexpr
-#endif
- bool
- test_property(typename Property<Type>::value_type value)
- {
- return (Property<Type>::value == value
- && Property<Type>::type::value == value);
- }
-
// For testing tr1/type_traits/extent, which has a second template
// parameter.
template<template<typename, unsigned> class Property,
return (Property<Type1, Types...>::value == value
&& Property<Type1, Types...>::type::value == value);
}
+#else
+ template<template<typename> class Property, typename Type>
+ bool
+ test_property(typename Property<Type>::value_type value)
+ {
+ return (Property<Type>::value == value
+ && Property<Type>::type::value == value);
+ }
#endif
template<template<typename, typename> class Relationship,