This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix PR c++/31724
- From: "Doug Gregor" <doug dot gregor at gmail dot com>
- To: "GCC Patches" <gcc-patches at gcc dot gnu dot org>
- Date: Fri, 29 Jun 2007 16:24:48 -0400
- Subject: [C++ PATCH] Fix PR c++/31724
This patch fixes PR 31724, a canonical types failure.
Tested powerpc-apple-darwin8.10.0, pre-approved by Mark, and committed.
- Doug
2007-06-29 Douglas Gregor <doug.gregor@gmail.com>
PR c++/31724
* init.c (build_new_1): Use structural equality on the copy of the
array type.
2007-06-29 Douglas Gregor <doug.gregor@gmail.com>
* g++.dg/other/canon-31724.C: New.
Index: cp/init.c
===================================================================
--- cp/init.c (revision 126081)
+++ cp/init.c (working copy)
@@ -1691,6 +1691,7 @@ build_new_1 (tree placement, tree type,
of the incomplete array type. */
full_type = build_distinct_type_copy (full_type);
TYPE_DOMAIN (full_type) = index;
+ SET_TYPE_STRUCTURAL_EQUALITY (full_type);
}
else
{
Index: testsuite/g++.dg/other/canon-31724.C
===================================================================
--- testsuite/g++.dg/other/canon-31724.C (revision 0)
+++ testsuite/g++.dg/other/canon-31724.C (revision 0)
@@ -0,0 +1,8 @@
+struct ac {ac();};
+ac spline_rep1(void)
+{
+ typedef ac at[2];
+ ac * b = new ac[2];
+ at *a = (at*)b;
+ return (*a)[0];
+}