aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Kenner <kenner@gcc.gnu.org>1995-09-11 18:41:44 -0400
committerRichard Kenner <kenner@gcc.gnu.org>1995-09-11 18:41:44 -0400
commit692ce0fd55f4b1c5294371884ad1db1843069a26 (patch)
tree00f99154144510124f6cf3e2bca700b1b02e3863
parentf7d9d4a857ef5548b2023ebc88987552620864c6 (diff)
downloadgcc-692ce0fd55f4b1c5294371884ad1db1843069a26.zip
gcc-692ce0fd55f4b1c5294371884ad1db1843069a26.tar.gz
gcc-692ce0fd55f4b1c5294371884ad1db1843069a26.tar.bz2
(redeclaration_error_message): For TYPE_DECLs, return 0 if
TYPE_MAIN_VARIANT of old type is same as new type. From-SVN: r10311
-rw-r--r--gcc/c-decl.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/gcc/c-decl.c b/gcc/c-decl.c
index def045f..b6ffd61 100644
--- a/gcc/c-decl.c
+++ b/gcc/c-decl.c
@@ -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'";