typeck.c (comptypes): when comparing pointer types...
authorAlexandre Oliva <oliva@dcc.unicamp.br>
Tue, 15 Sep 1998 14:28:07 +0000 (14:28 +0000)
committerAlexandre Oliva <oliva@gcc.gnu.org>
Tue, 15 Sep 1998 14:28:07 +0000 (14:28 +0000)
* typeck.c (comptypes): when comparing pointer types, check
whether referred types match even in strictest modes

From-SVN: r22429

gcc/cp/ChangeLog
gcc/cp/typeck.c

index 2531b0edfb44bc2cc29b6299d799eb0c56cd7a3f..6311f9433d9df289fa24893d2642a1e82debac9c 100644 (file)
@@ -1,3 +1,8 @@
+1998-09-15  Alexandre Oliva  <oliva@dcc.unicamp.br>
+
+       * typeck.c (comptypes): when comparing pointer types, check
+       whether referred types match even in strictest modes
+
 1998-09-15  Mark Mitchell  <mark@markmitchell.com>
 
        * cp-tree.h: Revert previous change.
index 50ab3e6d14403a777a548f4130c36055d6e2fe74..6fc3707160e31dd0aa9682bd9a9ef86b29949194 100644 (file)
@@ -853,11 +853,12 @@ comptypes (type1, type2, strict)
     case REFERENCE_TYPE:
       t1 = TREE_TYPE (t1);
       t2 = TREE_TYPE (t2);
-      if (t1 == t2)
-       {
-         val = 1;
-         break;
-       }
+      /* first, check whether the referred types match with the
+         required level of strictness */
+      val = comptypes (t1, t2, strict);
+      if (val)
+       break;
+      /* if they do not, try more relaxed alternatives */
       if (strict <= 0)
        {
          if (TREE_CODE (t1) == RECORD_TYPE && TREE_CODE (t2) == RECORD_TYPE)
@@ -879,8 +880,6 @@ comptypes (type1, type2, strict)
            }
          return 0;
        }
-      else
-       val = comptypes (t1, t2, strict);
       break;
 
     case FUNCTION_TYPE: