gcc/cp/ChangeLog:
PR c++/35909
* call.c (convert_like_real): Convert bitfield to desired type
before creating temporary.
gcc/testsuite/ChangeLog:
PR c++/35909
* g++.dg/conversion/bitfield9.C: New.
From-SVN: r135969
+2008-05-27 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/35909
+ * call.c (convert_like_real): Convert bitfield to desired type
+ before creating temporary.
+
2008-05-26 Daniel Franke <franke.daniel@gmail.com>
* Makefile.in: Adjusted dependencies on c-incpath.o.
return error_mark_node;
}
if (lvalue & clk_bitfield)
- expr = convert_bitfield_to_declared_type (expr);
+ {
+ expr = convert_bitfield_to_declared_type (expr);
+ expr = fold_convert (type, expr);
+ }
expr = build_target_expr_with_type (expr, type);
}
+2008-05-27 Alexandre Oliva <aoliva@redhat.com>
+
+ PR c++/35909
+ * g++.dg/conversion/bitfield9.C: New.
+
2008-05-26 Arnaud Charlet <charlet@adacore.com>
* gnat.dg/specs/array_no_def_init.ads: New test.
--- /dev/null
+// PR c++/35909
+// { dg-do compile }
+
+struct MidiCommand
+{
+ unsigned data1 : 8;
+};
+
+void g(const unsigned char &);
+void h(const unsigned int &);
+
+void f(MidiCommand mc)
+{
+ g(mc.data1);
+ h(mc.data1);
+}
+