diff options
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r-- | gcc/cp/class.c | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c index 54dc14c..4453b34 100644 --- a/gcc/cp/class.c +++ b/gcc/cp/class.c @@ -139,7 +139,7 @@ static tree build_vtbl_ref_1 (tree, tree); static tree build_vtbl_initializer (tree, tree, tree, tree, int *); static int count_fields (tree); static int add_fields_to_record_type (tree, struct sorted_fields_type*, int); -static void check_bitfield_decl (tree); +static bool check_bitfield_decl (tree); static void check_field_decl (tree, tree, int *, int *, int *); static void check_field_decls (tree, tree *, int *, int *); static tree *build_base_field (record_layout_info, tree, splay_tree, tree *); @@ -2655,9 +2655,9 @@ add_fields_to_record_type (tree fields, struct sorted_fields_type *field_vec, in /* FIELD is a bit-field. We are finishing the processing for its enclosing type. Issue any appropriate messages and set appropriate - flags. */ + flags. Returns false if an error has been diagnosed. */ -static void +static bool check_bitfield_decl (tree field) { tree type = TREE_TYPE (field); @@ -2675,7 +2675,6 @@ check_bitfield_decl (tree field) if (!INTEGRAL_TYPE_P (type)) { error ("bit-field %q+#D with non-integral type", field); - TREE_TYPE (field) = error_mark_node; w = error_mark_node; } else @@ -2720,12 +2719,14 @@ check_bitfield_decl (tree field) { DECL_SIZE (field) = convert (bitsizetype, w); DECL_BIT_FIELD (field) = 1; + return true; } else { /* Non-bit-fields are aligned for their type. */ DECL_BIT_FIELD (field) = 0; CLEAR_DECL_C_BIT_FIELD (field); + return false; } } @@ -3037,9 +3038,7 @@ check_field_decls (tree t, tree *access_decls, /* We set DECL_C_BIT_FIELD in grokbitfield. If the type and width are valid, we'll also set DECL_BIT_FIELD. */ - if (DECL_C_BIT_FIELD (x)) - check_bitfield_decl (x); - else + if (! DECL_C_BIT_FIELD (x) || ! check_bitfield_decl (x)) check_field_decl (x, t, cant_have_const_ctor_p, no_const_asn_ref_p, |