+2017-07-26 Jason Merrill <jason@redhat.com>
+
+ P0702R1 - List deduction of vector.
+ * pt.c (do_class_deduction): Special-case deduction from a single
+ element of related type.
+
2017-07-26 Leonid Koppel <lkoppel@uwaterloo.ca>
PR c++/67054 - Inherited ctor with non-default-constructible members
else if (BRACE_ENCLOSED_INITIALIZER_P (init))
{
try_list_ctor = TYPE_HAS_LIST_CTOR (type);
+ if (try_list_ctor && CONSTRUCTOR_NELTS (init) == 1)
+ {
+ /* As an exception, the first phase in 16.3.1.7 (considering the
+ initializer list as a single argument) is omitted if the
+ initializer list consists of a single expression of type cv U,
+ where U is a specialization of C or a class derived from a
+ specialization of C. */
+ tree elt = CONSTRUCTOR_ELT (init, 0)->value;
+ tree etype = TREE_TYPE (elt);
+
+ tree tparms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
+ tree targs = make_tree_vec (TREE_VEC_LENGTH (tparms));
+ int err = unify (tparms, targs, type, etype,
+ UNIFY_ALLOW_DERIVED, /*explain*/false);
+ if (err == 0)
+ try_list_ctor = false;
+ ggc_free (targs);
+ }
if (try_list_ctor || is_std_init_list (type))
args = make_tree_vector_single (init);
else
--- /dev/null
+// { dg-options -std=c++1z }
+
+#include <initializer_list>
+
+template <class,class> struct same;
+template <class T> struct same<T,T> { };
+
+template <class T>
+struct A
+{
+ A(const A&);
+ A(std::initializer_list<T>);
+};
+
+A a { 1 };
+A b { a };
+
+same<decltype (a), decltype (b)> s;
+