This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Patch for c++/9126


Hi. This is a patch to fix the template conversion function (overload) bug 
#9126. I did some tests, like running the testsuite for c++ but not with 
bootstrapping as I am not able to bootstrap atm.


Mikael


2004-12-02  Mikael Kilpelainen <mikael.kilpelainen@kolumbus.fi>

	PR c++/9126
	* call.c (joust): Handling template conversion functions correctly.

Index: call.c
===================================================================
RCS file: /cvsroot/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.520
diff -u -p -r1.520 call.c
--- call.c      24 Nov 2004 10:06:45 -0000      1.520
+++ call.c      30 Nov 2004 21:59:47 -0000
@@ -6027,12 +6027,15 @@ joust (struct z_candidate *cand1, struct

   /* or, if not that,
      F1 is a non-template function and F2 is a template function
-     specialization.  */
-
-  if (!cand1->template_decl && cand2->template_decl)
-    return 1;
-  else if (cand1->template_decl && !cand2->template_decl)
-    return -1;
+     specialization and they are not conversion functions  */
+
+  if (!cand1->second_conv)
+    {
+      if (!cand1->template_decl && cand2->template_decl)
+        return 1;
+      else if (cand1->template_decl && !cand2->template_decl)
+        return -1;
+    }

   /* or, if not that,
      F1 and F2 are template functions and the function template for F1 is
@@ -6073,6 +6076,13 @@ joust (struct z_candidate *cand1, struct
       winner = compare_ics (cand1->second_conv, cand2->second_conv);
       if (winner)
         return winner;
+      else
+        {
+          if (cand1->template_decl && !cand2->template_decl)
+            return -1;
+          else if (!cand1->template_decl && cand2->template_decl)
+            return 1;
+        }
     }

   /* Check whether we can discard a builtin candidate, either because we


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]