summaryrefslogtreecommitdiff
path: root/gcc/cp/class.c
diff options
context:
space:
mode:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-22 09:53:34 +0000
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>2003-07-22 09:53:34 +0000
commit8e68bf5f5d049ace68d8c4f52a163692f577b8e3 (patch)
tree6679a92cc9d1ed37f7676b33077730a559a92f24 /gcc/cp/class.c
parentf40175cb775955f4d641fbbbd138ad63ce759ca7 (diff)
downloadgcc-8e68bf5f5d049ace68d8c4f52a163692f577b8e3.tar.gz
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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@69669 138bc75d-0d04-0410-961f-82ee72b054a4
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 b9f139fc645..06cb6356719 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