This is the mail archive of the gcc-bugs@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]

[Bug c++/37016] [4.3/4.4 Regression] member function pointer failure with optimization



------- Comment #6 from rguenth at gcc dot gnu dot org  2008-08-04 13:41 -------
Of course it didn't work.  The following seems to

Index: gcc/cp/class.c
===================================================================
--- gcc/cp/class.c      (revision 138611)
+++ gcc/cp/class.c      (working copy)
@@ -6197,7 +6197,12 @@ resolve_address_of_overloaded_function (
     }

   if (TYPE_PTRFN_P (target_type) || TYPE_PTRMEMFUNC_P (target_type))
-    return cp_build_unary_op (ADDR_EXPR, fn, 0, flags);
+    {
+      tree tem = cp_build_unary_op (ADDR_EXPR, fn, 0, flags);
+      if (TREE_CODE (tem) == PTRMEM_CST)
+       return make_ptrmem_cst (target_type, fn);
+      return tem;
+    }
   else
     {
       /* The target must be a REFERENCE_TYPE.  Above, cp_build_unary_op


we might be able to unconditionally do return make_ptrmem_cst (target_type,
fn);
for TYPE_PTRMEMFUNC_P (target_type) though.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=37016


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