This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[Committed] Fix C++/30033, GC ICE with static_assert
- From: Andrew Pinski <pinskia at gmail dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Sat, 02 Dec 2006 08:58:45 -0800
- Subject: [Committed] Fix C++/30033, GC ICE with static_assert
When Doug changed the static_assert over to an exceptional tree from a
decl, he had added TS_CP_STATIC_ASSERT but he either did not know to
update cp_tree_node_structure or he forgot. This patch fixes that
problem and we now don't ICE when trying to GC a static_assert tree.
Committed as obvious after a bootstrap/test on i686-linux-gnu.
Thanks,
Andrew Pinski
ChangeLog:
* decl.c (cp_tree_node_structure): Handle STATIC_ASSERT.
* g++.dg/cpp0x/static_assert4.C: New testcase.
Index: testsuite/g++.dg/cpp0x/static_assert4.C
===================================================================
--- testsuite/g++.dg/cpp0x/static_assert4.C (revision 0)
+++ testsuite/g++.dg/cpp0x/static_assert4.C (revision 0)
@@ -0,0 +1,15 @@
+// { dg-options "-std=c++0x --param ggc-min-heapsize=0 --param ggc-min-expand=0 " }
+// PR C++/30033
+// Make sure that the static assert does not crash the GC.
+
+template <class T>
+struct default_delete
+{
+ void
+ operator() (T * ptr) const
+ {
+ static_assert (sizeof (T) > 0, "Can't delete pointer to incomplete type");
+ }
+};
+
+
Index: cp/decl.c
===================================================================
--- cp/decl.c (revision 119446)
+++ cp/decl.c (working copy)
@@ -11606,6 +11606,7 @@ cp_tree_node_structure (union lang_tree_
case TINST_LEVEL: return TS_CP_TINST_LEVEL;
case PTRMEM_CST: return TS_CP_PTRMEM;
case BASELINK: return TS_CP_BASELINK;
+ case STATIC_ASSERT: return TS_CP_STATIC_ASSERT;
default: return TS_CP_GENERIC;
}
}