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]

PR C++/28148


This patch fixes PR c++/28148.  The C++ front-end uses PTRMEM_CST
nodes to represent pointer-to-member constants in unlowered form.
When these make it to output_constant, they need to be lowered.  We
were handling that case -- but not a NOP_EXPR wrapped around a
PTRMEM_CST.  This near-obvious patch handles that.

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

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

2006-08-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/28148
	* varasm.c (output_constant): Give the front end another chance to
	expand constants, after stripping NOPs.

2006-08-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/28148
	* g++.dg/init/ptrmem3.C: New test.

Index: gcc/varasm.c
===================================================================
--- gcc/varasm.c	(revision 115850)
+++ gcc/varasm.c	(working copy)
@@ -4048,6 +4048,9 @@ output_constant (tree exp, unsigned HOST
   code = TREE_CODE (TREE_TYPE (exp));
   thissize = int_size_in_bytes (TREE_TYPE (exp));
 
+  /* Give the front end another chance to expand constants.  */
+  exp = lang_hooks.expand_constant (exp);
+
   /* Allow a constructor with no elements for any data type.
      This means to fill the space with zeros.  */
   if (TREE_CODE (exp) == CONSTRUCTOR
Index: gcc/testsuite/g++.dg/init/ptrmem3.C
===================================================================
--- gcc/testsuite/g++.dg/init/ptrmem3.C	(revision 0)
+++ gcc/testsuite/g++.dg/init/ptrmem3.C	(revision 0)
@@ -0,0 +1,8 @@
+// PR c++/28148
+
+struct foo {
+public:
+  virtual int bar(int);
+};
+
+void (foo::*__Virtual__foo__Var1)() = (void (foo::*)())(&foo::bar);


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