+2009-02-23 Jason Merrill <jason@redhat.com>
+
+ * pt.c (unify): Call maybe_adjust_types_for_deduction when
+ deducing from an initializer list.
+
2009-02-20 Jason Merrill <jason@redhat.com>
PR c++/39225
FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (arg), i, elt)
{
+ int elt_strict = strict;
if (!BRACE_ENCLOSED_INITIALIZER_P (elt))
- elt = TREE_TYPE (elt);
- if (unify (tparms, targs, elttype, elt, UNIFY_ALLOW_NONE))
+ {
+ tree type = TREE_TYPE (elt);
+ /* It should only be possible to get here for a call. */
+ gcc_assert (elt_strict & UNIFY_ALLOW_OUTER_LEVEL);
+ elt_strict |= maybe_adjust_types_for_deduction
+ (DEDUCE_CALL, &elttype, &type, elt);
+ elt = type;
+ }
+
+ if (unify (tparms, targs, elttype, elt, elt_strict))
return 1;
}
return 0;
--- /dev/null
+// Bug: We weren't doing the normal replacement of array with pointer
+// for deduction in the context of a call because of the initializer list.
+// { dg-options "-std=c++0x" }
+
+#include <initializer_list>
+
+struct string
+{
+ string (const char *);
+};
+
+template <class T>
+struct vector
+{
+ template <class U>
+ vector (std::initializer_list<U>);
+};
+
+vector<string> v = { "a", "b", "c" };