summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-23 22:48:37 +0000
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>2004-05-23 22:48:37 +0000
commit028e46e73c38d30b72ebb50e1190f385830ca17e (patch)
tree213a3972a017598389124eaebbdab15fa08899d3
parent86b92c8eb11dd5aad182f456dbb8ab13062a6550 (diff)
downloadppe42-gcc-028e46e73c38d30b72ebb50e1190f385830ca17e.tar.gz
ppe42-gcc-028e46e73c38d30b72ebb50e1190f385830ca17e.zip
PR c++/15165
* pt.c (instantiate_template): Robustify. PR c++/15165 * g++.dg/template/crash19.C: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82174 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c8
-rw-r--r--gcc/testsuite/ChangeLog5
-rw-r--r--gcc/testsuite/g++.dg/template/crash19.C17
4 files changed, 33 insertions, 2 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index 7fd46ac7108..a517716fc21 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,5 +1,10 @@
2004-05-23 Mark Mitchell <mark@codesourcery.com>
+ PR c++/15165
+ * pt.c (instantiate_template): Robustify.
+
+2004-05-23 Mark Mitchell <mark@codesourcery.com>
+
PR c++/15025
* decl.c (xref_tag): Issue errors about redeclaring template
classes as non-template classes.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index 2b124792572..38c91a0e188 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -8661,10 +8661,14 @@ instantiate_template (tree tmpl, tree targ_ptr, tsubst_flags_t complain)
/* If this function is a clone, handle it specially. */
if (DECL_CLONED_FUNCTION_P (tmpl))
{
- tree spec = instantiate_template (DECL_CLONED_FUNCTION (tmpl), targ_ptr,
- complain);
+ tree spec;
tree clone;
+ spec = instantiate_template (DECL_CLONED_FUNCTION (tmpl), targ_ptr,
+ complain);
+ if (spec == error_mark_node)
+ return error_mark_node;
+
/* Look for the clone. */
for (clone = TREE_CHAIN (spec);
clone && DECL_CLONED_FUNCTION_P (clone);
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 32d2f1717e0..82101e4804c 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,5 +1,10 @@
2004-05-23 Mark Mitchell <mark@codesourcery.com>
+ PR c++/15165
+ * g++.dg/template/crash19.C: New test.
+
+2004-05-23 Mark Mitchell <mark@codesourcery.com>
+
PR c++/15025
* g++.dg/template/redecl1.C: New test.
diff --git a/gcc/testsuite/g++.dg/template/crash19.C b/gcc/testsuite/g++.dg/template/crash19.C
new file mode 100644
index 00000000000..a28827f31ac
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/crash19.C
@@ -0,0 +1,17 @@
+// PR c++/15165
+
+struct S
+{
+ template <class T> S(const T &e);
+};
+int operator *(const double, const S &);
+template <class T>
+struct X {
+ enum { SIXTY_FOUR=64 };
+ struct node {
+ unsigned char *ptr[sizeof(T)*SIXTY_FOUR];
+ void d() {}
+ };
+ node *head;
+};
+template struct X<int>;
OpenPOWER on IntegriCloud