summaryrefslogtreecommitdiff
path: root/gcc/tree.c
diff options
context:
space:
mode:
authordgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-29 12:25:01 +0000
committerdgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2007-08-29 12:25:01 +0000
commit8059d3507a3bd61c18ab89d46babdf28df29c6ee (patch)
tree2b91b39e4ff5198911e5114e0cd3c9f44d0e6e73 /gcc/tree.c
parent2ee83bf5896135406813a049c5ed2571ed5d0703 (diff)
downloadgcc-8059d3507a3bd61c18ab89d46babdf28df29c6ee.tar.gz
2007-08-29 Douglas Gregor <doug.gregor@gmail.com>
PR c++/33194 * tree.c (build_type_attribute_qual_variant): Set canonical types on the final, unqualified attribute variant before building the qualified version. 2007-08-29 Douglas Gregor <doug.gregor@gmail.com> PR c++/33194 * g++.dg/other/canon-33194.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@127896 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/tree.c')
-rw-r--r--gcc/tree.c12
1 files changed, 5 insertions, 7 deletions
diff --git a/gcc/tree.c b/gcc/tree.c
index 759c06aea90..fc5c8246ccc 100644
--- a/gcc/tree.c
+++ b/gcc/tree.c
@@ -3678,12 +3678,6 @@ build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
TYPE_REFERENCE_TO (ntype) = 0;
TYPE_ATTRIBUTES (ntype) = attribute;
- if (TYPE_STRUCTURAL_EQUALITY_P (ttype))
- SET_TYPE_STRUCTURAL_EQUALITY (ntype);
- else
- TYPE_CANONICAL (ntype)
- = build_qualified_type (TYPE_CANONICAL (ttype), quals);
-
/* Create a new main variant of TYPE. */
TYPE_MAIN_VARIANT (ntype) = ntype;
TYPE_NEXT_VARIANT (ntype) = 0;
@@ -3726,8 +3720,12 @@ build_type_attribute_qual_variant (tree ttype, tree attribute, int quals)
/* If the target-dependent attributes make NTYPE different from
its canonical type, we will need to use structural equality
checks for this qualified type. */
- if (!targetm.comp_type_attributes (ntype, ttype))
+ ttype = build_qualified_type (ttype, TYPE_UNQUALIFIED);
+ if (TYPE_STRUCTURAL_EQUALITY_P (ttype)
+ || !targetm.comp_type_attributes (ntype, ttype))
SET_TYPE_STRUCTURAL_EQUALITY (ntype);
+ else
+ TYPE_CANONICAL (ntype) = TYPE_CANONICAL (ttype);
ttype = build_qualified_type (ntype, quals);
}