+2018-05-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/85883
+ * init.c (build_new): Handle deducing a class with new
+ with more than one argument.
+
2018-05-29 Jakub Jelinek <jakub@redhat.com>
PR c++/85952
if (auto_node)
{
tree d_init = NULL_TREE;
- if (vec_safe_length (*init) == 1)
+ const size_t len = vec_safe_length (*init);
+ /* E.g. new auto(x) must have exactly one element, or
+ a {} initializer will have one element. */
+ if (len == 1)
{
d_init = (**init)[0];
d_init = resolve_nondeduced_context (d_init, complain);
}
+ /* For the rest, e.g. new A(1, 2, 3), create a list. */
+ else if (len > 1)
+ {
+ unsigned int n;
+ tree t;
+ tree *pp = &d_init;
+ FOR_EACH_VEC_ELT (**init, n, t)
+ {
+ t = resolve_nondeduced_context (t, complain);
+ *pp = build_tree_list (NULL_TREE, t);
+ pp = &TREE_CHAIN (*pp);
+ }
+ }
type = do_auto_deduction (type, d_init, auto_node, complain);
}
}
+2018-05-29 Marek Polacek <polacek@redhat.com>
+
+ PR c++/85883
+ * g++.dg/cpp1z/class-deduction55.C: New test.
+ * g++.dg/cpp1z/class-deduction56.C: New test.
+ * g++.dg/cpp1z/class-deduction57.C: New test.
+
2018-05-29 Jakub Jelinek <jakub@redhat.com>
PR c++/85952
--- /dev/null
+// PR c++/85883
+// { dg-options -std=c++17 }
+
+template <typename T1, typename T2>
+struct Bar
+{
+ Bar(T1, T2) { }
+};
+
+int
+main ()
+{
+ auto x = Bar(1, 2);
+ auto y = new Bar(3, 4);
+}
--- /dev/null
+// PR c++/85883
+// { dg-options -std=c++17 }
+
+template <typename T1, typename T2, typename T3>
+struct Bar
+{
+ Bar(T1, T2, T3) { }
+};
+
+int
+main ()
+{
+ auto x = Bar(1, 2, 3);
+ auto y = new Bar(3, 4, 5);
+}