summaryrefslogtreecommitdiffstats
path: root/gcc/cp
diff options
context:
space:
mode:
authordgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-31 20:06:33 +0000
committerdgregor <dgregor@138bc75d-0d04-0410-961f-82ee72b054a4>2008-01-31 20:06:33 +0000
commit9a9847298b43776576baa29e437d52212af9fb46 (patch)
treee3ce23aff54310844d24fd7882f14fa469956d3d /gcc/cp
parent0d399d52eb56ad8716936425687b8fbdc69e0649 (diff)
downloadppe42-gcc-9a9847298b43776576baa29e437d52212af9fb46.tar.gz
ppe42-gcc-9a9847298b43776576baa29e437d52212af9fb46.zip
2008-01-31 Douglas Gregor <doug.gregor@gmail.com>
Jakub Jelinek <jakub@redhat.com> PR c++/34935 PR c++/34936 * typeck.c (structural_comptypes): Handle comparisons of VOID_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, FIXED_POINT_TYPE, and REAL_TYPE nodes. * mangle.c (write_builtin_type): Map down to the canonical type, which will be one of the predefined type nodes. 2008-01-31 Douglas Gregor <doug.gregor@gmail.com> Jakub Jelinek <jakub@redhat.com> PR c++/34935 PR c++/34936 * g++.dg/ext/alias-canon.C: New. * g++.dg/ext/alias-mangle.C: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@131984 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/cp')
-rw-r--r--gcc/cp/ChangeLog11
-rw-r--r--gcc/cp/mangle.c3
-rw-r--r--gcc/cp/typeck.c24
3 files changed, 38 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index a5d19e6bc69..5b4cc3bb49b 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,14 @@
+2008-01-31 Douglas Gregor <doug.gregor@gmail.com>
+ Jakub Jelinek <jakub@redhat.com>
+
+ PR c++/34935
+ PR c++/34936
+ * typeck.c (structural_comptypes): Handle comparisons of
+ VOID_TYPE, BOOLEAN_TYPE, INTEGER_TYPE, FIXED_POINT_TYPE, and
+ REAL_TYPE nodes.
+ * mangle.c (write_builtin_type): Map down to the canonical type,
+ which will be one of the predefined type nodes.
+
2008-01-29 Michael Meissner <michael.meissner@amd.com>
PR 35004
diff --git a/gcc/cp/mangle.c b/gcc/cp/mangle.c
index 7377a3ea455..09a34562e8d 100644
--- a/gcc/cp/mangle.c
+++ b/gcc/cp/mangle.c
@@ -1768,6 +1768,9 @@ write_CV_qualifiers_for_type (const tree type)
static void
write_builtin_type (tree type)
{
+ if (TYPE_CANONICAL (type))
+ type = TYPE_CANONICAL (type);
+
switch (TREE_CODE (type))
{
case VOID_TYPE:
diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c
index fd2a3193a47..4d6e06b5918 100644
--- a/gcc/cp/typeck.c
+++ b/gcc/cp/typeck.c
@@ -977,6 +977,30 @@ structural_comptypes (tree t1, tree t2, int strict)
/* Compare the types. Break out if they could be the same. */
switch (TREE_CODE (t1))
{
+ case VOID_TYPE:
+ case BOOLEAN_TYPE:
+ /* All void and bool types are the same. */
+ break;
+
+ case INTEGER_TYPE:
+ case FIXED_POINT_TYPE:
+ case REAL_TYPE:
+ /* With these nodes, we can't determine type equivalence by
+ looking at what is stored in the nodes themselves, because
+ two nodes might have different TYPE_MAIN_VARIANTs but still
+ represent the same type. For example, wchar_t and int could
+ have the same properties (TYPE_PRECISION, TYPE_MIN_VALUE,
+ TYPE_MAX_VALUE, etc.), but have different TYPE_MAIN_VARIANTs
+ and are distinct types. On the other hand, int and the
+ following typedef
+
+ typedef int INT __attribute((may_alias));
+
+ have identical properties, different TYPE_MAIN_VARIANTs, but
+ represent the same type. The canonical type system keeps
+ track of equivalence in this case, so we fall back on it. */
+ return TYPE_CANONICAL (t1) == TYPE_CANONICAL (t2);
+
case TEMPLATE_TEMPLATE_PARM:
case BOUND_TEMPLATE_TEMPLATE_PARM:
if (TEMPLATE_TYPE_IDX (t1) != TEMPLATE_TYPE_IDX (t2)
OpenPOWER on IntegriCloud