+2018-06-26 Jason Merrill <jason@redhat.com>
+
+ PR c++/80290 - memory-hog with std::pair.
+ * pt.c (type_unification_real): Skip non-dependent conversion
+ check for a nested list argument.
+ (braced_init_depth): New.
+
2018-06-26 Jakub Jelinek <jakub@redhat.com>
PR c++/86291
/*nondeduced*/false, array_deduction_r);
}
+/* Returns how many levels of { } INIT contains. */
+
+static int
+braced_init_depth (tree init)
+{
+ if (!init || !BRACE_ENCLOSED_INITIALIZER_P (init))
+ return 0;
+ unsigned i; tree val;
+ unsigned max = 0;
+ FOR_EACH_CONSTRUCTOR_VALUE (CONSTRUCTOR_ELTS (init), i, val)
+ {
+ unsigned elt_d = braced_init_depth (val);
+ if (elt_d > max)
+ max = elt_d;
+ }
+ return max + 1;
+}
+
/* Most parms like fn_type_unification.
If SUBR is 1, we're being called recursively (to unify the
if (uses_template_parms (parm))
continue;
+ /* Workaround for c++/80290: avoid combinatorial explosion on
+ deeply nested braced init-lists. */
+ if (braced_init_depth (arg) > 2)
+ continue;
if (check_non_deducible_conversion (parm, arg, strict, flags,
explain_p))
return 1;