pt.c (type_unification): If strict and the function parm doesn't use template parms...
authorJason Merrill <jason@gcc.gnu.org>
Wed, 3 Sep 1997 18:41:11 +0000 (14:41 -0400)
committerJason Merrill <jason@gcc.gnu.org>
Wed, 3 Sep 1997 18:41:11 +0000 (14:41 -0400)
* pt.c (type_unification): If strict and the function parm doesn't
use template parms, just compare types.

From-SVN: r15062

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

index b814f98cfc7f291c6bb647c424c21f222c05c285..fe2bdbaf00463656d4635a9bd7812d0d11cb2c84 100644 (file)
@@ -1,4 +1,9 @@
-Wed Sep  3 09:55:09 1997  Klaus Espenlaub  (kespenla@student.informatik.uni-ulm.de)
+Wed Sep  3 11:09:25 1997  Jason Merrill  <jason@yorick.cygnus.com>
+
+       * pt.c (type_unification): If strict and the function parm doesn't
+       use template parms, just compare types.
+
+Wed Sep  3 10:35:49 1997  Klaus Espenlaub  <kespenla@student.informatik.uni-ulm.de>
 
        * method.c (build_overloaded_value): Replace direct call
        to the floating point emulator with REAL_VALUE_TO_DECIMAL macro.
@@ -32,6 +37,15 @@ Tue Sep  2 10:27:08 1997  Richard Henderson  <rth@cygnus.com>
 
 Mon Sep  1 13:19:04 1997  Jason Merrill  <jason@yorick.cygnus.com>
 
+       * call.c (add_builtin_candidate): Add missing TREE_TYPE.
+       (compare_ics): Likewise.
+       From someone whose name I've lost (sorry).
+
+       * call.c (joust): Warn about choosing one conversion op over
+       another because of 'this' argument when the other return type is
+       better.
+       (source_type): New fn.
+
        * call.c (build_new_op): Strip leading REF_BIND from first operand
        to builtin operator.
 
index f2fe0380a93dd64b2f24d471536a456fe67da562..b30f78fcd4a0b00298da79399370987b768cc38c 100644 (file)
@@ -5781,6 +5781,8 @@ compare_ics (ics1, ics2)
   return 0;
 }
 
+/* The source type for this standard conversion sequence.  */
+
 static tree
 source_type (t)
      tree t;
index 4c79d948aa434a79247b3f052a8f693f45a3d3c6..9ba46ac21b2b92a2d43fd3883c517948928e2bda 100644 (file)
@@ -2664,11 +2664,38 @@ type_unification (tparms, targs, parms, args, nsubsts, subr, strict)
       if (arg == unknown_type_node)
        return 1;
 
-      if (! uses_template_parms (parm)
-         && TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
+      /* Conversions will be performed on a function argument that
+        corresponds with a function parameter that contains only
+        non-deducible template parameters and explicitly specified
+        template parameters.  */
+      if (! uses_template_parms (parm))
        {
-         if (can_convert_arg (parm, TREE_TYPE (arg), arg))
-           continue;
+         tree type;
+
+         if (TREE_CODE_CLASS (TREE_CODE (arg)) != 't')
+           type = TREE_TYPE (arg);
+         else
+           {
+             type = arg;
+             arg = NULL_TREE;
+           }
+
+         if (strict)
+           {
+             if (comptypes (parm, type, 1))
+               continue;
+           }
+         else if (arg)
+           {
+             if (can_convert_arg (parm, type, arg))
+               continue;
+           }
+         else
+           {
+             if (can_convert (parm, type))
+               continue;
+           }
+
          return 1;
        }