2014-01-07 Jason Merrill <jason@redhat.com>
+ PR c++/58856
+ * pt.c (num_innermost_template_parms): New.
+ (get_underlying_template): Use it.
+
PR c++/58965
* mangle.c (write_guarded_var_name): Handle null DECL_NAME.
&& DECL_ALIAS_TEMPLATE_P (TYPE_TI_TEMPLATE (t)));
}
+/* Return the number of innermost template parameters in TMPL. */
+
+static int
+num_innermost_template_parms (tree tmpl)
+{
+ tree parms = INNERMOST_TEMPLATE_PARMS (DECL_TEMPLATE_PARMS (tmpl));
+ return TREE_VEC_LENGTH (parms);
+}
+
/* Return either TMPL or another template that it is equivalent to under DR
1286: An alias that just changes the name of a template is equivalent to
the other template. */
{
tree sub = TYPE_TI_TEMPLATE (result);
if (PRIMARY_TEMPLATE_P (sub)
+ && (num_innermost_template_parms (tmpl)
+ == num_innermost_template_parms (sub))
&& same_type_p (result, TREE_TYPE (sub)))
{
/* The alias type is equivalent to the pattern of the
--- /dev/null
+// PR c++/58856
+// { dg-require-effective-target c++11 }
+
+template <typename T>
+struct U1 {};
+
+template <typename T1, typename... Ts>
+using U2 = U1<T1>;
+
+template <typename T1, typename... Ts>
+using U3 = U2<T1, Ts...>;