re PR c++/28363 (Default template parameter causes compiler segfault)

PR c++/28363
	* semantics.c (check_template_template_default_arg): Simplify
	error handling.

	* g++.dg/template/defarg10.C: New test.

From-SVN: r115640
This commit is contained in:
Volker Reichelt 2006-07-21 09:41:16 +00:00 committed by Volker Reichelt
parent 79387e574a
commit e488a090e6
4 changed files with 26 additions and 13 deletions

View File

@ -1,3 +1,9 @@
2006-07-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28363
* semantics.c (check_template_template_default_arg): Simplify
error handling.
2006-07-20 Jason Merrill <jason@redhat.com>
PR c++/28407

View File

@ -2143,19 +2143,8 @@ check_template_template_default_arg (tree argument)
&& TREE_CODE (argument) != UNBOUND_CLASS_TEMPLATE)
{
if (TREE_CODE (argument) == TYPE_DECL)
{
tree t = TREE_TYPE (argument);
/* Try to emit a slightly smarter error message if we detect
that the user is using a template instantiation. */
if (CLASSTYPE_TEMPLATE_INFO (t)
&& CLASSTYPE_TEMPLATE_INSTANTIATION (t))
error ("invalid use of type %qT as a default value for a "
"template template-parameter", t);
else
error ("invalid use of %qD as a default value for a template "
"template-parameter", argument);
}
error ("invalid use of type %qT as a default value for a template "
"template-parameter", TREE_TYPE (argument));
else
error ("invalid default argument for a template template parameter");
return error_mark_node;

View File

@ -1,3 +1,8 @@
2006-07-21 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/28363
* g++.dg/template/defarg10.C: New test.
2006-07-20 Paul Brook <paul@codesourcery.com>
PR 27363

View File

@ -0,0 +1,13 @@
// PR c++/28363
// { dg-do compile }
template<typename T, template<int> class = T> // { dg-error "invalid use of type" }
struct A;
typedef int I;
template<template<int> class = I> // { dg-error "invalid use of type" }
struct B;
struct S;
template<template<int> class = S> // { dg-error "invalid use of type" }
struct C;