diff options
author | Volker Reichelt <reichelt@igpm.rwth-aachen.de> | 2006-05-06 00:40:40 +0000 |
---|---|---|
committer | Volker Reichelt <reichelt@gcc.gnu.org> | 2006-05-06 00:40:40 +0000 |
commit | 620188c9f20847558d91a0fa3be1c04f31e8d646 (patch) | |
tree | 9141fbbecb4d94f135eb91d5b293886fd995b56d /gcc | |
parent | 57b529596a083ba3e972a5b452e00b030a6592f5 (diff) | |
download | gcc-620188c9f20847558d91a0fa3be1c04f31e8d646.zip gcc-620188c9f20847558d91a0fa3be1c04f31e8d646.tar.gz gcc-620188c9f20847558d91a0fa3be1c04f31e8d646.tar.bz2 |
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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/cp/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/cp/pt.c | 17 | ||||
-rw-r--r-- | gcc/testsuite/ChangeLog | 3 | ||||
-rw-r--r-- | gcc/testsuite/g++.dg/template/void1.C | 4 |
4 files changed, 21 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 31e40de..2fcb893 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -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. diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7b814ae..614de41 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index a51b52d..d259e40 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -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. diff --git a/gcc/testsuite/g++.dg/template/void1.C b/gcc/testsuite/g++.dg/template/void1.C new file mode 100644 index 0000000..732e9d0 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/void1.C @@ -0,0 +1,4 @@ +// PR c++/27430 +// { dg-do compile } + +template<void[]> struct A; // { dg-error "array of void" } |