re PR c++/28058 (ICE in inline_forbidden_p)
authorMark Mitchell <mark@codesourcery.com>
Sun, 27 Aug 2006 17:45:25 +0000 (17:45 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Sun, 27 Aug 2006 17:45:25 +0000 (17:45 +0000)
PR c++/28058
* pt.c (register_specialization): Return error_mark_node for
specialization-after-instantiation.
* decl2.c (mark_used): Mark the main function used when one of its
clones is used.

PR c++/28058
* g++.dg/template/spec31.C: New test.

From-SVN: r116491

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

index dd1df56fca4c8ef3a26d1ee0e6c2978d5e78893d..369a678036a98c245d099d9a5ffe25678f366efe 100644 (file)
@@ -1,3 +1,11 @@
+2006-08-27  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/28058
+       * pt.c (register_specialization): Return error_mark_node for
+       specialization-after-instantiation.
+       * decl2.c (mark_used): Mark the main function used when one of its
+       clones is used.
+       
 2006-08-27  Lee Millward  <lee.millward@codesourcery.com>
 
         PR c++/26573
index db1e9179a2ba23590b085efd3ab247173581cd6a..a6187e28006d6ad7cabd8c144452fe96e98caa83 100644 (file)
@@ -3494,6 +3494,8 @@ mark_used (tree decl)
     }
 
   TREE_USED (decl) = 1;
+  if (DECL_CLONED_FUNCTION_P (decl))
+    TREE_USED (DECL_CLONED_FUNCTION (decl)) = 1;
   /* If we don't need a value, then we don't need to synthesize DECL.  */
   if (skip_evaluation)
     return;
index 5e0c9541b9a7194f1cc58d2f40c291e0fedf69b3..17557c0fffaeacedabd3fc5da18ace644dc5c1ae 100644 (file)
@@ -1163,7 +1163,7 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
            {
              error ("specialization of %qD after instantiation",
                     fn);
-             return spec;
+             return error_mark_node;
            }
          else
            {
index c6d64573eaeb72f3368f05a1132055caf6d33a58..dd2456b89c75f7e2b74883c438ee24e63ab8e72a 100644 (file)
@@ -1,3 +1,8 @@
+2006-08-27  Mark Mitchell  <mark@codesourcery.com>
+
+       PR c++/28058
+       * g++.dg/template/spec31.C: New test.
+
 2006-08-27  Lee Millward  <lee.millward@codesourcery.com>
 
         PR c++/26573
diff --git a/gcc/testsuite/g++.dg/template/spec31.C b/gcc/testsuite/g++.dg/template/spec31.C
new file mode 100644 (file)
index 0000000..3b36ab4
--- /dev/null
@@ -0,0 +1,10 @@
+// PR c++/28058
+
+template<int> struct A
+{
+  A() {}
+};
+
+A<0> a;
+
+template<> A<0>::A() {} // { dg-error "specialization" }