OSDN Git Service

(redeclaration_error_message): For TYPE_DECLs, return 0 if
authorkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Sep 1995 22:41:44 +0000 (22:41 +0000)
committerkenner <kenner@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 11 Sep 1995 22:41:44 +0000 (22:41 +0000)
TYPE_MAIN_VARIANT of old type is same as new type.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@10311 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/c-decl.c

index def045f..b6ffd61 100644 (file)
@@ -2385,6 +2385,15 @@ redeclaration_error_message (newdecl, olddecl)
     {
       if (flag_traditional && TREE_TYPE (newdecl) == TREE_TYPE (olddecl))
        return 0;
+      /* pushdecl creates distinct types for TYPE_DECLs by calling
+        build_type_copy, so the above comparison generally fails.  We do
+        another test against the TYPE_MAIN_VARIANT of the olddecl, which
+        is equivalent to what this code used to do before the build_type_copy
+        call.  The variant type distinction should not matter for traditional
+        code, because it doesn't have type qualifiers.  */
+      if (flag_traditional 
+         && TYPE_MAIN_VARIANT (TREE_TYPE (olddecl)) == TREE_TYPE (newdecl))
+       return 0;
       if (DECL_IN_SYSTEM_HEADER (olddecl) || DECL_IN_SYSTEM_HEADER (newdecl))
        return 0;
       return "redefinition of `%s'";