Commit 2671a8ef by Jason Merrill Committed by Jason Merrill

re PR c++/60241 (internal compiler error: in finish_member_declaration, at cp/semantics.c:2617)

	PR c++/60241
	* pt.c (lookup_template_class_1): Update DECL_TEMPLATE_INSTANTIATIONS
	of the partial instantiation, not the most general template.
	(maybe_process_partial_specialization): Reassign everything on
	that list.

From-SVN: r208024
parent a810ee82
2014-02-21 Jason Merrill <jason@redhat.com> 2014-02-21 Jason Merrill <jason@redhat.com>
PR c++/60241
* pt.c (lookup_template_class_1): Update DECL_TEMPLATE_INSTANTIATIONS
of the partial instantiation, not the most general template.
(maybe_process_partial_specialization): Reassign everything on
that list.
PR c++/60216 PR c++/60216
* pt.c (register_specialization): Copy DECL_DELETED_FN to clones. * pt.c (register_specialization): Copy DECL_DELETED_FN to clones.
(check_explicit_specialization): Don't clone. (check_explicit_specialization): Don't clone.
......
...@@ -914,11 +914,13 @@ maybe_process_partial_specialization (tree type) ...@@ -914,11 +914,13 @@ maybe_process_partial_specialization (tree type)
t; t = TREE_CHAIN (t)) t; t = TREE_CHAIN (t))
{ {
tree inst = TREE_VALUE (t); tree inst = TREE_VALUE (t);
if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst)) if (CLASSTYPE_TEMPLATE_SPECIALIZATION (inst)
|| !COMPLETE_OR_OPEN_TYPE_P (inst))
{ {
/* We already have a full specialization of this partial /* We already have a full specialization of this partial
instantiation. Reassign it to the new member instantiation, or a full specialization has been
specialization template. */ looked up but not instantiated. Reassign it to the
new member specialization template. */
spec_entry elt; spec_entry elt;
spec_entry *entry; spec_entry *entry;
void **slot; void **slot;
...@@ -937,7 +939,7 @@ maybe_process_partial_specialization (tree type) ...@@ -937,7 +939,7 @@ maybe_process_partial_specialization (tree type)
*entry = elt; *entry = elt;
*slot = entry; *slot = entry;
} }
else if (COMPLETE_OR_OPEN_TYPE_P (inst)) else
/* But if we've had an implicit instantiation, that's a /* But if we've had an implicit instantiation, that's a
problem ([temp.expl.spec]/6). */ problem ([temp.expl.spec]/6). */
error ("specialization %qT after instantiation %qT", error ("specialization %qT after instantiation %qT",
...@@ -7596,7 +7598,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, ...@@ -7596,7 +7598,7 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
} }
/* Let's consider the explicit specialization of a member /* Let's consider the explicit specialization of a member
of a class template specialization that is implicitely instantiated, of a class template specialization that is implicitly instantiated,
e.g.: e.g.:
template<class T> template<class T>
struct S struct S
...@@ -7694,9 +7696,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context, ...@@ -7694,9 +7696,9 @@ lookup_template_class_1 (tree d1, tree arglist, tree in_decl, tree context,
/* Note this use of the partial instantiation so we can check it /* Note this use of the partial instantiation so we can check it
later in maybe_process_partial_specialization. */ later in maybe_process_partial_specialization. */
DECL_TEMPLATE_INSTANTIATIONS (templ) DECL_TEMPLATE_INSTANTIATIONS (found)
= tree_cons (arglist, t, = tree_cons (arglist, t,
DECL_TEMPLATE_INSTANTIATIONS (templ)); DECL_TEMPLATE_INSTANTIATIONS (found));
if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type if (TREE_CODE (template_type) == ENUMERAL_TYPE && !is_dependent_type
&& !DECL_ALIAS_TEMPLATE_P (gen_tmpl)) && !DECL_ALIAS_TEMPLATE_P (gen_tmpl))
......
// PR c++/60241
template <typename T>
struct x
{
template <typename U>
struct y
{
typedef T result2;
};
typedef y<int> zy;
};
template<>
template<class T>
struct x<int>::y
{
typedef double result2;
};
int main()
{
x<int>::zy::result2 xxx;
x<int>::y<int>::result2 xxx2;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment