]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
re PR c++/15165 (ICE in instantiate_template)
authorMark Mitchell <mark@codesourcery.com>
Sun, 23 May 2004 22:48:37 +0000 (22:48 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 23 May 2004 22:48:37 +0000 (22:48 +0000)
PR c++/15165
* pt.c (instantiate_template): Robustify.

PR c++/15165
* g++.dg/template/crash19.C: New test.

From-SVN: r82174

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/crash19.C [new file with mode: 0644]

index 7fd46ac7108b4ec0d2e45b446f3ca4fd1fc19c1c..a517716fc21ebf9f5ded3ea6dbeda3f883e11b10 100644 (file)
@@ -1,3 +1,8 @@
+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
index 2b12479257290ef9a75c412014dc4ecf1cc009f2..38c91a0e188fc90854fde9e65bece2c624df92b2 100644 (file)
@@ -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);
index 32d2f1717e0b45e31c6027bb98d80a6966921be9..82101e4804c720ede87fe295f0508dc5d56ae377 100644 (file)
@@ -1,3 +1,8 @@
+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
diff --git a/gcc/testsuite/g++.dg/template/crash19.C b/gcc/testsuite/g++.dg/template/crash19.C
new file mode 100644 (file)
index 0000000..a28827f
--- /dev/null
@@ -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>;