aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2003-07-22 09:53:34 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2003-07-22 09:53:34 +0000
commite0d1297c4320ae158fbba12f8d2a0ec2970462ba (patch)
tree6679a92cc9d1ed37f7676b33077730a559a92f24 /gcc/cp/class.c
parentc6e4cc53e53de0f671b715bfb83f37dbf73aaf2f (diff)
downloadgcc-e0d1297c4320ae158fbba12f8d2a0ec2970462ba.zip
gcc-e0d1297c4320ae158fbba12f8d2a0ec2970462ba.tar.gz
gcc-e0d1297c4320ae158fbba12f8d2a0ec2970462ba.tar.bz2
cp-tree.h (enum cp_lvalue_kind): Add clk_packed.
cp: * cp-tree.h (enum cp_lvalue_kind): Add clk_packed. * tree.c (lvalue_p_1): Set it. * class.c (check_field): Don't allow non-packed non-POD fields to be packed. * call.c (reference_binding): Need a temporary for all bitfield and packed fields. (convert_like_real): Check it is ok to make a temporary here. testsuite: * g++.dg/ext/packed3.C: New test. * g++.dg/ext/packed4.C: New test. From-SVN: r69669
Diffstat (limited to 'gcc/cp/class.c')
-rw-r--r--gcc/cp/class.c10
1 files changed, 9 insertions, 1 deletions
diff --git a/gcc/cp/class.c b/gcc/cp/class.c
index b9f139f..06cb635 100644
--- a/gcc/cp/class.c
+++ b/gcc/cp/class.c
@@ -2959,7 +2959,15 @@ check_field_decls (tree t, tree *access_decls,
if (TREE_CODE (x) == FIELD_DECL)
{
- DECL_PACKED (x) |= TYPE_PACKED (t);
+ if (TYPE_PACKED (t))
+ {
+ if (!pod_type_p (TREE_TYPE (x)) && !TYPE_PACKED (TREE_TYPE (x)))
+ cp_warning_at
+ ("ignoring packed attribute on unpacked non-POD field `%#D'",
+ x);
+ else
+ DECL_PACKED (x) = 1;
+ }
if (DECL_C_BIT_FIELD (x) && integer_zerop (DECL_INITIAL (x)))
/* We don't treat zero-width bitfields as making a class