Commit 8ec2ac34 by Mark Mitchell Committed by Mark Mitchell

pt.c (check_explicit_specialization): Don't abort on bogus explicit instantiations.

	* pt.c (check_explicit_specialization): Don't abort on bogus
	explicit instantiations.

From-SVN: r21643
parent b86c2124
1998-08-09 Mark Mitchell <mark@markmitchell.com>
* pt.c (check_explicit_specialization): Don't abort on bogus
explicit instantiations.
1998-08-07 Mark Mitchell <mark@markmitchell.com> 1998-08-07 Mark Mitchell <mark@markmitchell.com>
* typeck.c (require_complete_type): Use complete_type_or_else. * typeck.c (require_complete_type): Use complete_type_or_else.
......
...@@ -1205,19 +1205,33 @@ check_explicit_specialization (declarator, decl, template_count, flags) ...@@ -1205,19 +1205,33 @@ check_explicit_specialization (declarator, decl, template_count, flags)
if (ctype != NULL_TREE && TYPE_BEING_DEFINED (ctype)) if (ctype != NULL_TREE && TYPE_BEING_DEFINED (ctype))
{ {
/* Since finish_struct_1 has not been called yet, we if (!explicit_instantiation)
can't call lookup_fnfields. We note that this {
template is a specialization, and proceed, letting /* Since finish_struct_1 has not been called yet, we
finish_struct fix this up later. */ can't call lookup_fnfields. We note that this
tree ti = perm_tree_cons (NULL_TREE, template is a specialization, and proceed, letting
TREE_OPERAND (declarator, 1), finish_struct fix this up later. */
NULL_TREE); tree ti = perm_tree_cons (NULL_TREE,
TI_PENDING_SPECIALIZATION_FLAG (ti) = 1; TREE_OPERAND (declarator, 1),
DECL_TEMPLATE_INFO (decl) = ti; NULL_TREE);
/* This should not be an instantiation; explicit TI_PENDING_SPECIALIZATION_FLAG (ti) = 1;
instantiation directives can only occur at the top DECL_TEMPLATE_INFO (decl) = ti;
level. */ }
my_friendly_assert (!explicit_instantiation, 0); else
/* It's not legal to write an explicit instantiation in
class scope, e.g.:
class C { template void f(); }
This case is caught by the parser. However, on
something like:
template class C { void f(); };
(which is illegal) we can get here. The error will be
issued later. */
;
return decl; return decl;
} }
else if (ctype != NULL_TREE else if (ctype != NULL_TREE
......
//Build don't link: //Build don't link:
template class x {}; // ERROR - not a template instantiation XFAIL *-*-* template class x {}; // ERROR - not a template instantiation
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