+2006-08-30 Jason Merrill <jason@redhat.com>
+
+ PR c++/26670
+ * class.c (check_field_decls): Don't unset TYPE_PACKED until all
+ the fields have been processed.
+
2006-08-29 Andrew Pinski <pinskia@physics.uc.edu>
PR C++/28349
tree *next;
bool has_pointers;
int any_default_members;
+ int cant_pack = 0;
/* Assume there are no access declarations. */
*access_decls = NULL_TREE;
(0,
"ignoring packed attribute because of unpacked non-POD field %q+#D",
x);
- TYPE_PACKED (t) = 0;
+ cant_pack = 1;
}
else if (TYPE_ALIGN (TREE_TYPE (x)) > BITS_PER_UNIT)
DECL_PACKED (x) = 1;
is needed to free dynamic memory.
This seems enough for practical purposes. */
- if (warn_ecpp
- && has_pointers
- && TYPE_HAS_CONSTRUCTOR (t)
- && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
- && !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
+ if (warn_ecpp
+ && has_pointers
+ && TYPE_HAS_CONSTRUCTOR (t)
+ && TYPE_HAS_NONTRIVIAL_DESTRUCTOR (t)
+ && !(TYPE_HAS_INIT_REF (t) && TYPE_HAS_ASSIGN_REF (t)))
{
warning (OPT_Weffc__, "%q#T has pointer data members", t);
" but does not override %<operator=(const %T&)%>", t);
}
+ /* If any of the fields couldn't be packed, unset TYPE_PACKED. */
+ if (cant_pack)
+ TYPE_PACKED (t) = 0;
/* Check anonymous struct/anonymous union fields. */
finish_struct_anon (t);