aboutsummaryrefslogtreecommitdiff
path: root/gcc/cp/tree.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/tree.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/tree.c')
-rw-r--r--gcc/cp/tree.c14
1 files changed, 9 insertions, 5 deletions
diff --git a/gcc/cp/tree.c b/gcc/cp/tree.c
index 72173fe..59722ac 100644
--- a/gcc/cp/tree.c
+++ b/gcc/cp/tree.c
@@ -100,11 +100,12 @@ lvalue_p_1 (tree ref,
op1_lvalue_kind = lvalue_p_1 (TREE_OPERAND (ref, 0),
treat_class_rvalues_as_lvalues,
allow_cast_as_lvalue);
- if (op1_lvalue_kind
- /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
- situations. */
- && TREE_CODE (TREE_OPERAND (ref, 1)) == FIELD_DECL
- && DECL_C_BIT_FIELD (TREE_OPERAND (ref, 1)))
+ if (!op1_lvalue_kind
+ /* The "field" can be a FUNCTION_DECL or an OVERLOAD in some
+ situations. */
+ || TREE_CODE (TREE_OPERAND (ref, 1)) != FIELD_DECL)
+ ;
+ else if (DECL_C_BIT_FIELD (TREE_OPERAND (ref, 1)))
{
/* Clear the ordinary bit. If this object was a class
rvalue we want to preserve that information. */
@@ -112,6 +113,9 @@ lvalue_p_1 (tree ref,
/* The lvalue is for a btifield. */
op1_lvalue_kind |= clk_bitfield;
}
+ else if (DECL_PACKED (TREE_OPERAND (ref, 1)))
+ op1_lvalue_kind |= clk_packed;
+
return op1_lvalue_kind;
case STRING_CST: