+2018-06-18 Jason Merrill <jason@redhat.com>
+
+ PR c++/86171 - ICE with recursive alias instantiation.
+ * pt.c (tsubst_decl): Handle recursive alias instantiation.
+
2018-06-18 Paolo Carlini <paolo.carlini@oracle.com>
* decl.c (duplicate_decls): Consistently use DECL_SOURCE_LOCATION
}
/* Create a new node for the specialization we need. */
- r = copy_decl (t);
if (type == NULL_TREE)
{
if (is_typedef_decl (t))
sub_args = strip_innermost_template_args (args, extra);
}
type = tsubst (type, sub_args, complain, in_decl);
+ /* Substituting the type might have recursively instantiated this
+ same alias (c++/86171). */
+ if (gen_tmpl && DECL_ALIAS_TEMPLATE_P (gen_tmpl)
+ && (spec = retrieve_specialization (gen_tmpl, argvec, hash)))
+ {
+ r = spec;
+ break;
+ }
}
+ r = copy_decl (t);
if (VAR_P (r))
{
DECL_INITIALIZED_P (r) = 0;
--- /dev/null
+// PR c++/86171
+// { dg-do compile { target c++11 } }
+
+template <class> struct A;
+template <class T> using B = typename A<T>::X;
+template <class T> struct A {
+ typedef int X;
+ typedef B<T> U;
+};
+B<short> b;