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 27979


This patch fixes PR c++/27979, more fallout from my recent bitfield
changes.  Here, we were forgetting to drop cv-qualifiers in an rvalue
context.

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

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

2006-06-16  Mark Mitchell  <mark@codesourcery.com>

	PR c++/27979
	* call.c (standard_conversion): Strip cv-qualifiers from bitfield
	types.

2006-06-16  Mark Mitchell  <mark@codesourcery.com>

	PR c++/27979
	* g++.dg/expr/bitfield2.C: New test. 

Index: gcc/cp/call.c
===================================================================
--- gcc/cp/call.c	(revision 114702)
+++ gcc/cp/call.c	(working copy)
@@ -632,7 +632,7 @@ standard_conversion (tree to, tree from,
 	  tree bitfield_type;
 	  bitfield_type = is_bitfield_expr_with_lowered_type (expr);
 	  if (bitfield_type)
-	    from = bitfield_type;
+	    from = strip_top_quals (bitfield_type);
 	}
       conv = build_conv (ck_rvalue, from, conv);
     }
Index: gcc/testsuite/g++.dg/expr/bitfield2.C
===================================================================
--- gcc/testsuite/g++.dg/expr/bitfield2.C	(revision 0)
+++ gcc/testsuite/g++.dg/expr/bitfield2.C	(revision 0)
@@ -0,0 +1,9 @@
+// PR c++/27979
+
+class Ast
+{
+  enum AstKind { };
+  const AstKind kind : 8;
+  void foo(AstKind k) { }
+  void bar(void) { foo(kind); }
+};


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