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 17585


This patch fixes PR c++/17585, a regression in the handling of static
member functions.  Tested on i686-pc-linux-gnu, applied on the
mainline, and, shortly, on the 3.4 branch.

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

2004-09-27  Mark Mitchell  <mark@codesourcery.com>

	PR c++/17585
	* semantics.c (finish_id_expression): Do not add "this->" to
	static member functions.

2004-09-27  Mark Mitchell  <mark@codesourcery.com>

	PR c++/17585
	* g++.dg/template/static8.C: New test.

Index: cp/semantics.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/semantics.c,v
retrieving revision 1.438
diff -c -5 -p -r1.438 semantics.c
*** cp/semantics.c	21 Sep 2004 02:22:45 -0000	1.438
--- cp/semantics.c	27 Sep 2004 14:44:06 -0000
*************** finish_id_expression (tree id_expression
*** 2644,2654 ****
  
  	  if (!really_overloaded_fn (decl))
  	    mark_used (first_fn);
  
  	  if (TREE_CODE (first_fn) == FUNCTION_DECL
! 	      && DECL_FUNCTION_MEMBER_P (first_fn))
  	    {
  	      /* A set of member functions.  */
  	      decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0);
  	      return finish_class_member_access_expr (decl, id_expression);
  	    }
--- 2644,2654 ----
  
  	  if (!really_overloaded_fn (decl))
  	    mark_used (first_fn);
  
  	  if (TREE_CODE (first_fn) == FUNCTION_DECL
! 	      && DECL_NONSTATIC_MEMBER_FUNCTION_P (first_fn))
  	    {
  	      /* A set of member functions.  */
  	      decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0);
  	      return finish_class_member_access_expr (decl, id_expression);
  	    }
Index: testsuite/g++.dg/template/static8.C
===================================================================
RCS file: testsuite/g++.dg/template/static8.C
diff -N testsuite/g++.dg/template/static8.C
*** /dev/null	1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/static8.C	27 Sep 2004 14:44:07 -0000
***************
*** 0 ****
--- 1,8 ----
+ // PR c++/17585
+ 
+ template <void (*p)(void)> struct S03 {};
+ class C03 {
+ public:
+   static void f(void) {}
+   void g(void) { S03<&f> s03; }
+ };


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