+2006-05-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27505
+ * call.c (convert_like_real): Convert bitfields to their declared
+ types when forming an rvalue.
+ * tree.c (convert_bitfield_to_declared_type): New function.
+ (rvalue): Use it.
+ * cp-tree.h (convert_bitfield_to_declare_type): Declare it.
+
2006-05-15 Volker Reichelt <reichelt@igpm.rwth-aachen.de>
PR c++/27582
extern int cp_auto_var_in_fn_p (tree,tree);
extern tree fold_if_not_in_template (tree);
extern tree rvalue (tree);
+extern tree convert_bitfield_to_declared_type (tree);
/* in typeck.c */
extern int string_conv_p (tree, tree, int);
return build_target_expr_with_type (init, TREE_TYPE (init));
}
+/* If EXPR is a bitfield reference, convert it to the declared type of
+ the bitfield, and return the resulting expression. Otherwise,
+ return EXPR itself. */
+
+tree
+convert_bitfield_to_declared_type (tree expr)
+{
+ tree bitfield_type;
+
+ bitfield_type = is_bitfield_expr_with_lowered_type (expr);
+ if (bitfield_type)
+ expr = cp_convert (TYPE_MAIN_VARIANT (bitfield_type), expr);
+ return expr;
+}
+
/* EXPR is being used in an rvalue context. Return a version of EXPR
that is marked as an rvalue. */
tree
rvalue (tree expr)
{
- tree type;
+ expr = convert_bitfield_to_declared_type (expr);
if (real_lvalue_p (expr))
{
- type = is_bitfield_expr_with_lowered_type (expr);
- if (type)
- return cp_convert (TYPE_MAIN_VARIANT (type), expr);
- type = TREE_TYPE (expr);
+ tree type;
/* [basic.lval]
Non-class rvalues always have cv-unqualified types. */
+ type = TREE_TYPE (expr);
if (!CLASS_TYPE_P (type))
type = TYPE_MAIN_VARIANT (type);
expr = build1 (NON_LVALUE_EXPR, type, expr);
+2006-05-15 Mark Mitchell <mark@codesourcery.com>
+
+ PR c++/27505
+ * g++.dg/expr/bitfield1.C: New test.
+
2006-05-15 Richard Guenther <rguenther@suse.de>
PR tree-optimization/27603