summaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorlmillward <lmillward@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-15 17:21:09 +0000
committerlmillward <lmillward@138bc75d-0d04-0410-961f-82ee72b054a4>2006-08-15 17:21:09 +0000
commit26f73e103ce90020ca42ccde4e03e7da02aa2b99 (patch)
tree6f94e361b433416c5300723a2b281d3b4f0daf3e /gcc
parenta05c50ded7ab9385f71e475dc581094700805532 (diff)
downloadgcc-26f73e103ce90020ca42ccde4e03e7da02aa2b99.tar.gz
PR c++/28594
* pt.c (process_template_parm): Robustify. * g++.dg/template/void6.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@116160 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc')
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c17
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/void6.C3
4 files changed, 24 insertions, 6 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 9194192f51d..53efac92540 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-15 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/28594
+ * pt.c (process_template_parm): Robustify.
+
2006-08-14 Steve Ellcey <sje@cup.hp.com>
PR c++/28288
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index c744759899b..4c2b45a5a69 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2352,19 +2352,24 @@ process_template_parm (tree list, tree parm, bool is_non_type)
{
tree decl = 0;
tree defval;
- int idx;
+ int idx = 0;
gcc_assert (TREE_CODE (parm) == TREE_LIST);
defval = TREE_PURPOSE (parm);
if (list)
{
- tree p = TREE_VALUE (tree_last (list));
+ tree p = tree_last (list);
+
+ if (p && p != error_mark_node)
+ {
+ p = TREE_VALUE (p);
+ if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
+ idx = TEMPLATE_TYPE_IDX (TREE_TYPE (p));
+ else
+ idx = TEMPLATE_PARM_IDX (DECL_INITIAL (p));
+ }
- if (TREE_CODE (p) == TYPE_DECL || TREE_CODE (p) == TEMPLATE_DECL)
- idx = TEMPLATE_TYPE_IDX (TREE_TYPE (p));
- else
- idx = TEMPLATE_PARM_IDX (DECL_INITIAL (p));
++idx;
}
else
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index d88769987e8..030212f05e4 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,8 @@
+2006-08-15 Lee Millward <lee.millward@codesourcery.com>
+
+ PR c++/28594
+ * g++.dg/template/void6.C: New test.
+
2006-08-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c/28649
diff --git a/gcc/testsuite/g++.dg/template/void6.C b/gcc/testsuite/g++.dg/template/void6.C
new file mode 100644
index 00000000000..2d5f7ead184
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/void6.C
@@ -0,0 +1,3 @@
+//PR c++/28594
+
+template<void, int> struct A; // { dg-error "not a valid type" }