commit a1607c38aaf6e04c2a601ee78dca67984e179986
Author: Jason Merrill <jason@redhat.com>
Date: Mon Jan 12 13:27:20 2015 -0500
PR c++/64520
* pt.c (unify): Don't try to deduce to std::initializer_list<T...>.
@@ -17854,7 +17854,13 @@ unify (tree tparms, tree targs, tree parm, tree arg, int strict,
if (TREE_CODE (parm) == ARRAY_TYPE)
elttype = TREE_TYPE (parm);
else
- elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0);
+ {
+ elttype = TREE_VEC_ELT (CLASSTYPE_TI_ARGS (parm), 0);
+ /* Deduction is defined in terms of a single type, so just punt
+ on the (bizarre) std::initializer_list<T...>. */
+ if (PACK_EXPANSION_P (elttype))
+ return unify_success (explain_p);
+ }
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt)
{
new file mode 100644
@@ -0,0 +1,8 @@
+// PR c++/64520
+// { dg-do compile { target c++11 } }
+
+#include <initializer_list>
+struct A {
+ template <typename... B> A(std::initializer_list<B...>);
+};
+A a { 0 }; // { dg-error "" }