This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

C++ PATCH: PR 27292


My original patch for PR c++/27292 fixed the reduced test case in the
PR, but not the original test case.  This patch corrects that
oversight.

Tested on x86_64-unknown-linux-gnu, applied to the mainline.

--
Mark Mitchell
CodeSourcery
mark@codesourcery.com
(650) 331-3385 x713

2006-04-27  Mark Mitchell  <mark@codesourcery.com>

	PR c++/27292
	* tree.c (rvalue): Convert bitfields to their declared types.

2006-04-27  Mark Mitchell  <mark@codesourcery.com>

	PR c++/27292
	* g++.dg/conversion/bitfield4.C: New test.

Index: gcc/cp/tree.c
===================================================================
--- gcc/cp/tree.c	(revision 113240)
+++ gcc/cp/tree.c	(working copy)
@@ -372,8 +372,9 @@ rvalue (tree expr)
   if (real_lvalue_p (expr))
     {
       type = is_bitfield_expr_with_lowered_type (expr);
-      if (!type)
-	type = TREE_TYPE (expr);
+      if (type)
+	return cp_convert (TYPE_MAIN_VARIANT (type), expr);
+      type = TREE_TYPE (expr);
       /* [basic.lval]
 	 
          Non-class rvalues always have cv-unqualified types.  */
Index: gcc/testsuite/g++.dg/conversion/bitfield4.C
===================================================================
--- gcc/testsuite/g++.dg/conversion/bitfield4.C	(revision 0)
+++ gcc/testsuite/g++.dg/conversion/bitfield4.C	(revision 0)
@@ -0,0 +1,20 @@
+// PR c++/27292
+
+enum ColorRole
+{
+  WindowText, Button
+};
+
+struct QPalette {
+
+ColorRole bg_role:8;
+
+ bool hasBackground();
+};
+
+
+bool
+QPalette::hasBackground ()
+{
+  return (ColorRole (bg_role) != WindowText);
+}


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]