OSDN Git Service

* decl.c (redeclaration_error_message): If two TEMPLATE_DECLs have
authormmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jun 2000 21:41:28 +0000 (21:41 +0000)
committermmitchel <mmitchel@138bc75d-0d04-0410-961f-82ee72b054a4>
Tue, 6 Jun 2000 21:41:28 +0000 (21:41 +0000)
the same DECL_RESULT, it's not a redefinition.
* pt.c (tsubst_decl): Remove code to handle illegal
specializations.

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

gcc/cp/decl.c
gcc/cp/pt.c

index 60e8f9f..b7abbc8 100644 (file)
@@ -4729,6 +4729,8 @@ redeclaration_error_message (newdecl, olddecl)
   else if (TREE_CODE (newdecl) == TEMPLATE_DECL)
     {
       if ((TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == FUNCTION_DECL
+          && (DECL_TEMPLATE_RESULT (newdecl) 
+              != DECL_TEMPLATE_RESULT (olddecl))
           && DECL_INITIAL (DECL_TEMPLATE_RESULT (newdecl))
           && DECL_INITIAL (DECL_TEMPLATE_RESULT (olddecl)))
          || (TREE_CODE (DECL_TEMPLATE_RESULT (newdecl)) == TYPE_DECL
index 9908c54..aab25c9 100644 (file)
@@ -5569,61 +5569,6 @@ tsubst_decl (t, args, type, in_decl)
        if (TREE_CODE (decl) == TYPE_DECL)
          break;
 
-       for (spec = DECL_TEMPLATE_SPECIALIZATIONS (t);
-            spec != NULL_TREE;
-            spec = TREE_CHAIN (spec))
-         {
-           /* It helps to consider example here.  Consider:
-
-              template <class T>
-              struct S {
-                template <class U>
-                void f(U u);
-
-                template <>
-                void f(T* t) {}
-              };
-              
-              Now, for example, we are instantiating S<int>::f(U u).  
-              We want to make a template:
-
-              template <class U>
-              void S<int>::f(U);
-
-              It will have a specialization, for the case U = int*, of
-              the form:
-
-              template <>
-              void S<int>::f<int*>(int*);
-
-              This specialization will be an instantiation of
-              the specialization given in the declaration of S, with
-              argument list int*.  */
-
-           tree fn = TREE_VALUE (spec);
-           tree spec_args;
-           tree new_fn;
-
-           if (!DECL_TEMPLATE_SPECIALIZATION (fn))
-             /* Instantiations are on the same list, but they're of
-                no concern to us.  */
-             continue;
-
-           if (TREE_CODE (fn) != TEMPLATE_DECL)
-             /* A full specialization.  There's no need to record
-                that here.  */
-             continue;
-
-           spec_args = tsubst (DECL_TI_ARGS (fn), args,
-                               /*complain=*/1, in_decl); 
-           new_fn
-             = tsubst (DECL_TEMPLATE_RESULT (most_general_template (fn)), 
-                       spec_args, /*complain=*/1, in_decl); 
-           DECL_TI_TEMPLATE (new_fn) = fn;
-           register_specialization (new_fn, r, 
-                                    INNERMOST_TEMPLATE_ARGS (spec_args));
-         }
-
        /* Record this partial instantiation.  */
        register_specialization (r, t, 
                                 DECL_TI_ARGS (DECL_TEMPLATE_RESULT (r)));