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 22545


This patch fixes a problem that dates back to the point at which we
eliminated the goofy POINTER_TYPE on pointer-to-data-members.

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

--
Mark Mitchell
CodeSourcery, LLC
mark@codesourcery.com

2005-07-28  Mark Mitchell  <mark@codesourcery.com>

	PR c++/22545
	* call.c (add_builtin_candidate): Adjust for changes in
	representation of pointer-to-member types.

2005-07-28  Mark Mitchell  <mark@codesourcery.com>

	PR c++/22545
	* g++.dg/expr/ptrmem7.C: New test.

Index: gcc/cp/call.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/call.c,v
retrieving revision 1.548
diff -c -5 -p -r1.548 call.c
*** gcc/cp/call.c	24 Jul 2005 21:37:53 -0000	1.548
--- gcc/cp/call.c	28 Jul 2005 18:00:25 -0000
*************** add_builtin_candidate (struct z_candidat
*** 1699,1709 ****
  	  tree c1 = TREE_TYPE (type1);
  	  tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
  
  	  if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
  	      && (TYPE_PTRMEMFUNC_P (type2)
! 		  || is_complete (TREE_TYPE (TREE_TYPE (type2)))))
  	    break;
  	}
        return;
  
  /* 13For every pair of promoted arithmetic types L and R, there exist  can-
--- 1699,1709 ----
  	  tree c1 = TREE_TYPE (type1);
  	  tree c2 = TYPE_PTRMEM_CLASS_TYPE (type2);
  
  	  if (IS_AGGR_TYPE (c1) && DERIVED_FROM_P (c2, c1)
  	      && (TYPE_PTRMEMFUNC_P (type2)
! 		  || is_complete (TYPE_PTRMEM_POINTED_TO_TYPE (type2))))
  	    break;
  	}
        return;
  
  /* 13For every pair of promoted arithmetic types L and R, there exist  can-
Index: gcc/testsuite/g++.dg/expr/ptrmem7.C
===================================================================
RCS file: gcc/testsuite/g++.dg/expr/ptrmem7.C
diff -N gcc/testsuite/g++.dg/expr/ptrmem7.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- gcc/testsuite/g++.dg/expr/ptrmem7.C	28 Jul 2005 18:00:25 -0000
***************
*** 0 ****
--- 1,21 ----
+ // PR c++/22545
+ 
+ struct A {
+   int member;
+   A() : member(13) {}
+ };
+ 
+ A a;
+ 
+ struct B {
+   operator A*() { return &a; }
+ };
+ 
+ B b;
+ 
+ int A::* member_pntr = &A::member;
+ 
+ int main()
+ {
+   return b ->* member_pntr;
+ }


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