PR c++/35056
* tree.c: Include tree-flow.h.
(build_target_expr): Check type compatibility.
* Make-lang.in (cp/tree.o): Depend on $(TREE_FLOW_H).
* call.c (convert_like_real): Convert bitfield to expected type.
gcc/testsuite/ChangeLog:
PR c++/35056
* g++.dg/conversion/bitfield8.C: New.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@132158
138bc75d-0d04-0410-961f-
82ee72b054a4
+2008-02-06 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/35056
+ * tree.c: Include tree-flow.h.
+ (build_target_expr): Check type compatibility.
+ * Make-lang.in (cp/tree.o): Depend on $(TREE_FLOW_H).
+ * call.c (convert_like_real): Convert bitfield to expected type.
+
2008-02-06 Douglas Gregor <doug.gregor@gmail.com>
PR c++/35049
# Top level -*- makefile -*- fragment for GNU C++.
# Copyright (C) 1994, 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2007
+# 2005, 2007, 2008
# Free Software Foundation, Inc.
#This file is part of GCC.
cp/search.o: cp/search.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H)
cp/tree.o: cp/tree.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h $(RTL_H) \
insn-config.h $(INTEGRATE_H) $(TREE_INLINE_H) $(REAL_H) gt-cp-tree.h \
- $(TARGET_H) debug.h
+ $(TARGET_H) debug.h $(TREE_FLOW_H)
cp/ptree.o: cp/ptree.c $(CXX_TREE_H) $(TM_H)
cp/rtti.o: cp/rtti.c $(CXX_TREE_H) $(TM_H) $(FLAGS_H) toplev.h convert.h \
$(TARGET_H) gt-cp-rtti.h
expr, ref_type);
return error_mark_node;
}
+ if (lvalue & clk_bitfield)
+ expr = convert_bitfield_to_declared_type (expr);
expr = build_target_expr_with_type (expr, type);
}
/* Language-dependent node constructors for parse phase of GNU compiler.
Copyright (C) 1987, 1988, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
- 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007
+ 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 2008
Free Software Foundation, Inc.
Hacked by Michael Tiemann (tiemann@cygnus.com)
#include "debug.h"
#include "target.h"
#include "convert.h"
+#include "tree-flow.h"
static tree bot_manip (tree *, int *, void *);
static tree bot_replace (tree *, int *, void *);
{
tree t;
+#ifdef ENABLE_CHECKING
+ gcc_assert (VOID_TYPE_P (TREE_TYPE (value))
+ || TREE_TYPE (decl) == TREE_TYPE (value)
+ || useless_type_conversion_p (TREE_TYPE (decl),
+ TREE_TYPE (value)));
+#endif
+
t = build4 (TARGET_EXPR, TREE_TYPE (decl), decl, value,
cxx_maybe_build_cleanup (decl), NULL_TREE);
/* We always set TREE_SIDE_EFFECTS so that expand_expr does not
+2008-02-06 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/35056
+ * g++.dg/conversion/bitfield8.C: New.
+
2008-02-06 Douglas Gregor <doug.gregor@gmail.com>
* g++.dg/ext/vector13.C: Fix for compilation under -pedantic.
--- /dev/null
+// PR c++/35056
+// { dg-do compile }
+// { dg-options "-O2" }
+
+enum EBorderStyle { bla = 1 };
+inline bool compare_ref(const unsigned int &t, const EBorderStyle &u)
+{ return t == u; }
+inline bool compare_val(const unsigned int t, const EBorderStyle u)
+{ return t == u; }
+struct S {
+ unsigned m_style : 4;
+};
+void call_ref (S *s, EBorderStyle v)
+{ if (!compare_ref(s->m_style, v)) s->m_style = v; }
+void call_val (S *s, EBorderStyle v)
+{ if (!compare_val(s->m_style, v)) s->m_style = v; }