OSDN Git Service

* pt.c (register_specialization): Use duplicate_decls to merge
authorjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Jul 2009 03:50:57 +0000 (03:50 +0000)
committerjason <jason@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 2 Jul 2009 03:50:57 +0000 (03:50 +0000)
the argument with a previous specialization.
(check_explicit_specialization): Call register_specialization to
merge the TEMPLATE_DECL with a previous version.
(determine_specialization): Return the args even if fn is a template.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@149165 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c

index 7aa9024..6e79df9 100644 (file)
@@ -1,3 +1,11 @@
+2009-07-01  Jason Merrill  <jason@redhat.com>
+
+       * pt.c (register_specialization): Use duplicate_decls to merge
+       the argument with a previous specialization.
+       (check_explicit_specialization): Call register_specialization to
+       merge the TEMPLATE_DECL with a previous version.
+       (determine_specialization): Return the args even if fn is a template.
+
 2009-07-01  Ian Lance Taylor  <iant@google.com>
 
        * g++spec.c (lang_specific_driver): Bump num_args by 1.
index b7c309d..125b80e 100644 (file)
@@ -1312,6 +1312,8 @@ register_specialization (tree spec, tree tmpl, tree args, bool is_friend)
          return fn;
        }
     }
+  else if (fn)
+    return duplicate_decls (spec, fn, is_friend);
 
   /* A specialization must be declared in the same namespace as the
      template it is specializing.  */
@@ -1701,12 +1703,13 @@ determine_specialization (tree template_id,
   if (candidates)
     {
       tree fn = TREE_VALUE (candidates);
-      /* DECL is a re-declaration of a template function.  */
+      *targs_out = copy_node (DECL_TI_ARGS (fn));
+      /* DECL is a re-declaration or partial instantiation of a template
+        function.  */
       if (TREE_CODE (fn) == TEMPLATE_DECL)
        return fn;
       /* It was a specialization of an ordinary member function in a
         template class.  */
-      *targs_out = copy_node (DECL_TI_ARGS (fn));
       return DECL_TI_TEMPLATE (fn);
     }
 
@@ -2237,7 +2240,8 @@ check_explicit_specialization (tree declarator,
                       parm = TREE_CHAIN (parm))
                    DECL_CONTEXT (parm) = result;
                }
-             return tmpl;
+             return register_specialization (tmpl, gen_tmpl, targs,
+                                             is_friend);
            }
 
          /* Set up the DECL_TEMPLATE_INFO for DECL.  */