From dbe91deb9a7ab4b7952a2ae7e897e92b9b90915a Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Wed, 12 Oct 2005 10:59:27 +0000 Subject: re PR c++/19964 (ICE on invalid member declaration) PR c++/19964 * stor-layout.c (place_field): Set DECL_FIELD_OFFSET and DECL_FIELD_BIT_OFFSET of FIELD_DECLs, even if they have an invalid type. cp: PR c++/19964 * cp/class.c (walk_subobject_offsets): Don't walk error_mark_node. testsuite: PR c++/19964 * g++.dg/parse/crash31.C: New. From-SVN: r105293 --- gcc/stor-layout.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'gcc/stor-layout.c') diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c index aec80a3..7b81abf 100644 --- a/gcc/stor-layout.c +++ b/gcc/stor-layout.c @@ -800,9 +800,19 @@ place_field (record_layout_info rli, tree field) /* The type of this field. */ tree type = TREE_TYPE (field); - if (TREE_CODE (field) == ERROR_MARK || TREE_CODE (type) == ERROR_MARK) - return; + gcc_assert (TREE_CODE (field) != ERROR_MARK); + if (TREE_CODE (type) == ERROR_MARK) + { + if (TREE_CODE (field) == FIELD_DECL) + { + DECL_FIELD_OFFSET (field) = size_int (0); + DECL_FIELD_BIT_OFFSET (field) = bitsize_int (0); + } + + return; + } + /* If FIELD is static, then treat it like a separate variable, not really like a structure field. If it is a FUNCTION_DECL, it's a method. In both cases, all we do is lay out the decl, and we do -- cgit v1.1