aboutsummaryrefslogtreecommitdiff
path: root/gcc/c-common.c
diff options
context:
space:
mode:
authorDouglas Gregor <doug.gregor@gmail.com>2007-04-12 11:47:56 +0000
committerDoug Gregor <dgregor@gcc.gnu.org>2007-04-12 11:47:56 +0000
commit95764818247765a24047c276777839ec8875a595 (patch)
tree88963ed1125aa1dd825676f3893fc6db6c464dd5 /gcc/c-common.c
parenta670437d9246cc31ae8115c03a7f5c3553e13f45 (diff)
downloadgcc-95764818247765a24047c276777839ec8875a595.zip
gcc-95764818247765a24047c276777839ec8875a595.tar.gz
gcc-95764818247765a24047c276777839ec8875a595.tar.bz2
re PR c++/31078 (warning: same canonical type node for different types with const strings)
2007-04-12 Douglas Gregor <doug.gregor@gmail.com> PR c++/31078 PR c++/31103 * c-common.c (c_build_qualified_type): Set canonical type appropriately. 2007-04-12 Douglas Gregor <doug.gregor@gmail.com> PR c++/31078 * g++.dg/other/pr31078.C: New. From-SVN: r123740
Diffstat (limited to 'gcc/c-common.c')
-rw-r--r--gcc/c-common.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gcc/c-common.c b/gcc/c-common.c
index 8f71e691..761a9b4 100644
--- a/gcc/c-common.c
+++ b/gcc/c-common.c
@@ -2894,8 +2894,26 @@ c_build_qualified_type (tree type, int type_quals)
}
if (!t)
{
+ tree domain = TYPE_DOMAIN (type);
+
t = build_variant_type_copy (type);
TREE_TYPE (t) = element_type;
+
+ if (TYPE_STRUCTURAL_EQUALITY_P (element_type)
+ || (domain && TYPE_STRUCTURAL_EQUALITY_P (domain)))
+ SET_TYPE_STRUCTURAL_EQUALITY (t);
+ else if (TYPE_CANONICAL (element_type) != element_type
+ || (domain && TYPE_CANONICAL (domain) != domain))
+ {
+ tree unqualified_canon
+ = build_array_type (TYPE_CANONICAL (element_type),
+ domain? TYPE_CANONICAL (domain)
+ : NULL_TREE);
+ TYPE_CANONICAL (t)
+ = c_build_qualified_type (unqualified_canon, type_quals);
+ }
+ else
+ TYPE_CANONICAL (t) = t;
}
return t;
}