cvt.c (ocp_convert): Avoid infinite recursion caused by 1998-10-03 change.
authorMark Mitchell <mark@markmitchell.com>
Fri, 9 Oct 1998 10:32:01 +0000 (10:32 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Fri, 9 Oct 1998 10:32:01 +0000 (10:32 +0000)
* cvt.c (ocp_convert): Avoid infinite recursion caused by
1998-10-03 change.

From-SVN: r22958

gcc/cp/ChangeLog
gcc/cp/cvt.c

index 7ef415c822e7ef6b7d7380576639ea9438ccf6cc..b781ad1afa934d1ae1b16e47f9d6efb315151ad8 100644 (file)
@@ -1,3 +1,8 @@
+1998-10-09  Mark Mitchell  <mark@markmitchell.com>
+
+       * cvt.c (ocp_convert): Avoid infinite recursion caused by
+       1998-10-03 change.
+
 1998-10-08  Jason Merrill  <jason@yorick.cygnus.com>
 
        * pt.c (resolve_overloaded_unification): New fn.
index f2b41d80b141481beb19af069528df9dbb0f7385..50c4fc59b33ba8df7d7a6cc8c3ddbd89c006742f 100644 (file)
@@ -679,12 +679,12 @@ ocp_convert (type, expr, convtype, flags)
        /* The call to fold will not always remove the NOP_EXPR as
           might be expected, since if one of the types is a typedef;
           the comparsion in fold is just equality of pointers, not a
-          call to comptypes.  */
-       ;
+          call to comptypes.  We don't call fold in this case because
+          that can result in infinite recursion; fold will call
+          convert, which will call ocp_convert, etc.  */
+       return e;
       else
-       e = build1 (NOP_EXPR, type, e);
-
-      return fold (e);
+       return fold (build1 (NOP_EXPR, type, e));
     }
 
   if (code == VOID_TYPE && (convtype & CONV_STATIC))