From e53ec543e66382d2552e89077e05fe70e2a75c78 Mon Sep 17 00:00:00 2001 From: Jason Merrill Date: Wed, 3 Apr 2019 17:51:36 -0400 Subject: PR c++/81866 - ICE with member template and default targ. This testcase manages to find a way to look up the partial instantiation of B for the default argument of C before we've created the partial instantiation of B as part of the normal instantiation of the members of A. Which we can deal with, but we were getting confused because the partial instantiation was stored with a RECORD_TYPE specialization rather than TEMPLATE_DECL. * pt.c (tsubst_template_decl): Handle getting a type from retrieve_specialization. From-SVN: r270138 --- gcc/cp/pt.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'gcc/cp/pt.c') diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 2b92b60..9cb29d2 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -13266,7 +13266,13 @@ tsubst_template_decl (tree t, tree args, tsubst_flags_t complain, hash = hash_tmpl_and_args (t, full_args); spec = retrieve_specialization (t, full_args, hash); if (spec != NULL_TREE) - return spec; + { + if (TYPE_P (spec)) + /* Type partial instantiations are stored as the type by + lookup_template_class_1, not here as the template. */ + spec = CLASSTYPE_TI_TEMPLATE (spec); + return spec; + } } /* Make a new template decl. It will be similar to the -- cgit v1.1