------- Comment #17 from spark at gcc dot gnu dot org 2007-04-17 17:36 -------
I'm testing the following patch (which fixes the ICE).
It turned out to be a latent bug in the warning code not handling pointer types
correctly.
Index: cp/decl2.c
===================================================================
--- cp/decl2.c (revision 123879)
+++ cp/decl2.c (working copy)
@@ -1856,7 +1856,7 @@ constrain_class_visibility (tree type)
for (t = TYPE_FIELDS (type); t; t = TREE_CHAIN (t))
if (TREE_CODE (t) == FIELD_DECL && TREE_TYPE (t) != error_mark_node)
{
- tree ftype = strip_array_types (TREE_TYPE (t));
+ tree ftype = strip_pointer_or_array_types (TREE_TYPE (t));
int subvis = type_visibility (ftype);
if (subvis == VISIBILITY_ANON)
Index: c-common.c
===================================================================
--- c-common.c (revision 123879)
+++ c-common.c (working copy)
@@ -3894,6 +3894,15 @@ strip_pointer_operator (tree t)
return t;
}
+/* Recursively remove pointer or array type from TYPE. */
+tree
+strip_pointer_or_array_types (tree t)
+{
+ while (TREE_CODE (t) == ARRAY_TYPE || POINTER_TYPE_P (t))
+ t = TREE_TYPE (t);
+ return t;
+}
+
/* Used to compare case labels. K1 and K2 are actually tree nodes
representing case labels, or NULL_TREE for a `default' label.
Returns -1 if K1 is ordered before K2, -1 if K1 is ordered after
Index: c-common.h
===================================================================
--- c-common.h (revision 123879)
+++ c-common.h (working copy)
@@ -727,6 +727,7 @@ extern bool c_promoting_integer_type_p (
extern int self_promoting_args_p (tree);
extern tree strip_array_types (tree);
extern tree strip_pointer_operator (tree);
+extern tree strip_pointer_or_array_types (tree);
extern HOST_WIDE_INT c_common_to_target_charset (HOST_WIDE_INT);
/* This is the basic parsing function. */
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=29365