Commit df266ea5 by Jason Merrill Committed by Jason Merrill

re PR c++/54416 (ICE (segv) in codegen)

	PR c++/54416
	* pt.c (maybe_process_partial_specialization): Don't accept
	definition of a specialization without the appropriate header.

From-SVN: r194408
parent befd067c
2012-12-11 Jason Merrill <jason@redhat.com> 2012-12-11 Jason Merrill <jason@redhat.com>
PR c++/54416
* pt.c (maybe_process_partial_specialization): Don't accept
definition of a specialization without the appropriate header.
* pt.c (maybe_process_partial_specialization): Handle aliases first. * pt.c (maybe_process_partial_specialization): Handle aliases first.
2012-12-11 Jakub Jelinek <jakub@redhat.com> 2012-12-11 Jakub Jelinek <jakub@redhat.com>
......
...@@ -850,7 +850,13 @@ maybe_process_partial_specialization (tree type) ...@@ -850,7 +850,13 @@ maybe_process_partial_specialization (tree type)
} }
else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type)) else if (CLASSTYPE_TEMPLATE_INSTANTIATION (type))
error ("specialization of %qT after instantiation", type); error ("specialization of %qT after instantiation", type);
else if (errorcount && !processing_specialization
&& CLASSTYPE_TEMPLATE_SPECIALIZATION (type)
&& !uses_template_parms (CLASSTYPE_TI_ARGS (type)))
/* Trying to define a specialization either without a template<> header
or in an inappropriate place. We've already given an error, so just
bail now so we don't actually define the specialization. */
return error_mark_node;
} }
else if (CLASS_TYPE_P (type) else if (CLASS_TYPE_P (type)
&& !CLASSTYPE_USE_TEMPLATE (type) && !CLASSTYPE_USE_TEMPLATE (type)
......
...@@ -10,5 +10,8 @@ template < typename > struct S < int > ...@@ -10,5 +10,8 @@ template < typename > struct S < int >
void void
f () f ()
{ {
S < int >::f (); // { dg-error "cannot call" } S < int >::f ();
} }
// Don't be picky about error-recovery.
// { dg-prune-output "." }
// PR c++/54416
template < typename T > struct foo;
template <> struct foo < int >;
template < typename T > struct bar
{
template <> struct foo < int > // { dg-error "non-namespace scope" }
{
void baz ();
};
};
void foo < int >::baz () { }
// Don't be picky about error-recovery.
// { dg-prune-output "." }
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