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: PR7931


This patch fixes PR7931, a regression on the mainline.  (I caused this
regression with some of my parser-related cleanup patches.)

Tested on i686-pc-linux-gnu, applied on the mainline.

--
Mark Mitchell                mark@codesourcery.com
CodeSourcery, LLC            http://www.codesourcery.com
2002-10-03  Mark Mitchell  <mark@codesourcery.com>

	PR c++/7931
	* pt.c (for_each_template_parm_r): Handle BASELINKs.
	
	PR c++/7931
	* g++.dg/template/ptrmem3.C: New test.
	
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.620
diff -c -5 -p -r1.620 pt.c
*** cp/pt.c	2 Oct 2002 20:01:36 -0000	1.620
--- cp/pt.c	4 Oct 2002 03:48:34 -0000
*************** for_each_template_parm_r (tp, walk_subtr
*** 4467,4476 ****
--- 4467,4485 ----
     case PSEUDO_DTOR_EXPR:
       if (!fn)
 	return error_mark_node;
       break;

+     case BASELINK:
+       /* If we do not handle this case specially, we end up walking
+ 	 the BINFO hierarchy, which is circular, and therefore
+ 	 confuses walk_tree.  */
+       *walk_subtrees = 0;
+       if (for_each_template_parm (BASELINK_FUNCTIONS (*tp), fn, data))
+ 	return error_mark_node;
+       break;
+
     default:
       break;
     }

   /* We didn't find any template parameters we liked.  */
Index: testsuite/g++.dg/template/ptrmem3.C
===================================================================
RCS file: testsuite/g++.dg/template/ptrmem3.C
diff -N testsuite/g++.dg/template/ptrmem3.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/ptrmem3.C	4 Oct 2002 03:50:37 -0000
***************
*** 0 ****
--- 1,22 ----
+ // Origin: Theo Papadopoulo <Theodore.Papadopoulo@sophia.inria.fr>
+
+ template <typename T,double (T::*fun)() const>
+ struct I {
+ };
+
+ struct R {
+     R() { }
+ };
+
+ class H: public R {
+ public:
+     H(): R() { }
+     double& f() { return a; }
+     double  f() const { return 1.0; }
+     double a;
+ };
+
+ struct A {
+     typedef I<H,&H::f> F;
+     A() { }
+ };

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