re PR c++/27430 (ICE on array of voids as template parameter)

PR c++/27430
	* pt.c (process_template_parm): Handle erroneous non-type parameters.

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

From-SVN: r113572
This commit is contained in:
Volker Reichelt 2006-05-06 00:40:40 +00:00 committed by Volker Reichelt
parent 57b529596a
commit 620188c9f2
4 changed files with 21 additions and 6 deletions

View file

@ -1,5 +1,8 @@
2006-05-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27430
* pt.c (process_template_parm): Handle erroneous non-type parameters.
PR c++/27423
* typeck.c (convert_for_initialization): Skip erroneous types.

View file

@ -2347,18 +2347,23 @@ process_template_parm (tree list, tree next, bool is_non_type)
SET_DECL_TEMPLATE_PARM_P (parm);
/* [temp.param]
if (TREE_TYPE (parm) == error_mark_node)
TREE_TYPE (parm) = void_type_node;
else
{
/* [temp.param]
The top-level cv-qualifiers on the template-parameter are
ignored when determining its type. */
TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
The top-level cv-qualifiers on the template-parameter are
ignored when determining its type. */
TREE_TYPE (parm) = TYPE_MAIN_VARIANT (TREE_TYPE (parm));
if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
TREE_TYPE (parm) = void_type_node;
}
/* A template parameter is not modifiable. */
TREE_CONSTANT (parm) = 1;
TREE_INVARIANT (parm) = 1;
TREE_READONLY (parm) = 1;
if (invalid_nontype_parm_type_p (TREE_TYPE (parm), 1))
TREE_TYPE (parm) = void_type_node;
decl = build_decl (CONST_DECL, DECL_NAME (parm), TREE_TYPE (parm));
TREE_CONSTANT (decl) = 1;
TREE_INVARIANT (decl) = 1;

View file

@ -1,5 +1,8 @@
2006-05-06 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27430
* g++.dg/template/void1.C: New test.
PR c++/27423
* g++.dg/other/void2.C: New test.

View file

@ -0,0 +1,4 @@
// PR c++/27430
// { dg-do compile }
template<void[]> struct A; // { dg-error "array of void" }