summaryrefslogtreecommitdiff
path: root/gcc/stor-layout.c
diff options
context:
space:
mode:
authorJason Merrill <jason@redhat.com>2006-07-05 22:09:02 -0400
committerJason Merrill <jason@gcc.gnu.org>2006-07-05 22:09:02 -0400
commit1937f93932b3249756fbeda05a0b0c67aaed0405 (patch)
treee5a04b6dd5dab15766d0b02b4b48425818534909 /gcc/stor-layout.c
parent562349cab017b2abc827517378ac50a1f4a1f438 (diff)
downloadgcc-1937f93932b3249756fbeda05a0b0c67aaed0405.tar.gz
re PR c++/13983 (no warning on some non-POD struct with packed attribute)
PR c++/13983 PR c++/17519 * stor-layout.c (finish_record_layout): Copy TYPE_PACKED to variants. * c-common.c (handle_packed_attribute): So don't copy it here. * c-decl.c (finish_struct): Don't copy TYPE_ALIGN. * cp/class.c (check_field_decls): Check TYPE_PACKED after stripping array types. (finish_struct_bits): Don't copy TYPE_SIZE here. From-SVN: r115217
Diffstat (limited to 'gcc/stor-layout.c')
-rw-r--r--gcc/stor-layout.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/gcc/stor-layout.c b/gcc/stor-layout.c
index 47bc6a047a7..76aa4ac73bb 100644
--- a/gcc/stor-layout.c
+++ b/gcc/stor-layout.c
@@ -1465,6 +1465,8 @@ finalize_type_size (tree type)
void
finish_record_layout (record_layout_info rli, int free_p)
{
+ tree variant;
+
/* Compute the final size. */
finalize_record_size (rli);
@@ -1474,6 +1476,12 @@ finish_record_layout (record_layout_info rli, int free_p)
/* Perform any last tweaks to the TYPE_SIZE, etc. */
finalize_type_size (rli->t);
+ /* Propagate TYPE_PACKED to variants. With C++ templates,
+ handle_packed_attribute is too early to do this. */
+ for (variant = TYPE_NEXT_VARIANT (rli->t); variant;
+ variant = TYPE_NEXT_VARIANT (variant))
+ TYPE_PACKED (variant) = TYPE_PACKED (rli->t);
+
/* Lay out any static members. This is done now because their type
may use the record's type. */
while (rli->pending_statics)