]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
decl.c (duplicate_decls): Handle template specializations correctly.
authorMark Mitchell <mmitchell@usa.net>
Mon, 20 Oct 1997 18:46:24 +0000 (18:46 +0000)
committerJason Merrill <jason@gcc.gnu.org>
Mon, 20 Oct 1997 18:46:24 +0000 (14:46 -0400)
Mon Oct 20 11:44:20 1997  Mark Mitchell  <mmitchell@usa.net>

* decl.c (duplicate_decls): Handle template specializations
correctly.
* error.c (dump_function_name): Fix printing of specializations of
member functions that are not member templates.
* cp-tree.h (processing_specialization): Make global.
* pt.c (processing_specialization): Likewise.
* lex.c (cons_up_default_function): Save and restore
processing_specialization to avoid confusion.

From-SVN: r16101

gcc/cp/ChangeLog
gcc/cp/class.c
gcc/cp/cp-tree.h
gcc/cp/decl.c
gcc/cp/error.c
gcc/cp/lex.c
gcc/cp/pt.c

index c30348906ef10004a9da7a6f66cf653ab646c3cc..56722890d115f37e7720a504265c3477665ae84f 100644 (file)
@@ -1,3 +1,14 @@
+Mon Oct 20 11:44:20 1997  Mark Mitchell  <mmitchell@usa.net>
+
+       * decl.c (duplicate_decls): Handle template specializations
+       correctly. 
+       * error.c (dump_function_name): Fix printing of specializations of
+       member functions that are not member templates.
+       * cp-tree.h (processing_specialization): Make global.
+       * pt.c (processing_specialization): Likewise.
+       * lex.c (cons_up_default_function): Save and restore
+       processing_specialization to avoid confusion.
+       
 Mon Oct 20 10:52:22 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
        * decl.c (init_decl_processing): Give null_node unknown* type.
index e24d6a230b946cad77aeae9532c0b9e680e6d430..aac95b815d1aad5e5ecc76d46a39961d4e40cf19 100644 (file)
@@ -2093,7 +2093,7 @@ finish_struct_methods (t, fn_fields, nonprivate_method)
            tree f;
            tree spec_args;
 
-           /* If there is a template, and t uses template parms, wer
+           /* If there is a template, and t uses template parms, we
               are dealing with a specialization of a member
               template in a template class, and we must grab the
               template, rather than the function.  */
index 3cb83df2580cc0b21f5e57fb521a616bf9005031..06a8c647103ed92d4fd7850ba352bb26c1ee94af 100644 (file)
@@ -2352,6 +2352,7 @@ extern tree most_specialized_class                PROTO((tree, tree));
 extern int more_specialized_class              PROTO((tree, tree));
 extern void do_pushlevel                       PROTO((void));
 extern int is_member_template                   PROTO((tree));
+extern int processing_specialization;
 
 /* in repo.c */
 extern void repo_template_used                 PROTO((tree));
index 59fdbb32757d66dc09da3bb2c20ab6a50b954c60..ca21b486f8dc876eeb669084ef122eb1ba7afe1b 100644 (file)
@@ -2866,6 +2866,9 @@ duplicate_decls (newdecl, olddecl)
 
   if (TREE_CODE (newdecl) == FUNCTION_DECL)
     {
+      if (DECL_TEMPLATE_INSTANTIATION (olddecl) &&
+         !DECL_TEMPLATE_INSTANTIATION (newdecl)) 
+       DECL_USE_TEMPLATE (olddecl) = DECL_USE_TEMPLATE (newdecl);
       DECL_THIS_INLINE (newdecl) |= DECL_THIS_INLINE (olddecl);
 
       /* If either decl says `inline', this fn is inline, unless its
index 5128175233f495b1abb90ea91e56ecbd72a9204f..5cac56510d6417c4ca595c438fdd9de4e8683a1c 100644 (file)
@@ -925,7 +925,8 @@ dump_function_name (t)
   else
     dump_decl (name, 0);
 
-  if (DECL_TEMPLATE_SPECIALIZATION (t) || DECL_IMPLICIT_INSTANTIATION (t))
+  if ((DECL_TEMPLATE_SPECIALIZATION (t) || DECL_IMPLICIT_INSTANTIATION (t))
+      && (DECL_CLASS_CONTEXT (t) == NULL_TREE || is_member_template (t)))
     {
       tree args = DECL_TEMPLATE_INFO (t) 
        ? DECL_TI_ARGS (t) : NULL_TREE; 
index 9a795353f7d61bec2464759077aa6f7533a7957d..863fe4cbdcddb96b58f40c66b39edbee4d9fbcbf 100644 (file)
@@ -1988,10 +1988,16 @@ cons_up_default_function (type, full_name, kind)
 
   {
     tree declarator = make_call_declarator (name, args, NULL_TREE, NULL_TREE);
+    int saved_processing_specialization;
     if (retref)
       declarator = build_parse_node (ADDR_EXPR, declarator);
-    
+
+    /* The following is in case we're generating the default
+       implementation in the midst of handling a specialization. */
+    saved_processing_specialization = processing_specialization;
+    processing_specialization = 0;
     fn = grokfield (declarator, declspecs, NULL_TREE, NULL_TREE, NULL_TREE);
+    processing_specialization = saved_processing_specialization;
   }
   
   if (fn == void_type_node)
index df453fc78560db4ece5ba8fd6aca5128f3eac028..304d48942e93e63ee6c38c785c18dcbf680d818e 100644 (file)
@@ -60,7 +60,7 @@ static tree *maybe_template_tail = &maybe_templates;
 
 int minimal_parse_mode;
 
-static int processing_specialization;
+int processing_specialization;
 static int template_header_count;
 
 #define obstack_chunk_alloc xmalloc