This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
PATCH for g++ code generation bug
- To: Jason Merrill <jason at cygnus dot com>
- Subject: PATCH for g++ code generation bug
- From: Mark Mitchell <mmitchell at usa dot net>
- Date: Wed, 18 Mar 1998 11:08:22 -0800
- Cc: egcs-bugs at cygnus dot com, Jan Reimers <janr at molienergy dot bc dot ca>
- Reply-to: mmitchell at usa dot net
Jan --
Here's a patch for the problem you reported with static member
functions. Jason, is this OK?
--
Mark Mitchell <mmitchell@usa.net>
http://home.earthlink.net/~mbmitchell
Consulting Services Available
Wed Mar 18 11:05:48 1998 Mark Mitchell <mmitchell@usa.net>
* pt.c (check_explicit_specialization): When reverting a static
member function, also remove the `this' parameter from
last_function_parms.
Index: testsuite/g++.old-deja/g++.pt/static1.C
===================================================================
RCS file: static1.C
diff -N static1.C
*** /dev/null Mon Dec 31 20:00:00 1979
--- static1.C Wed Mar 18 11:03:00 1998
***************
*** 0 ****
--- 1,21 ----
+ extern "C" void abort();
+
+ template <class T>
+ class A
+ {
+ public:
+ static int foo(int);
+ };
+
+ template <>
+ int A<int>::foo(int i)
+ {
+ return i;
+ }
+
+
+ int main()
+ {
+ if (A<int>::foo(22) != 22)
+ abort();
+ }
Index: cp/pt.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/cp/pt.c,v
retrieving revision 1.96
diff -c -p -r1.96 pt.c
*** pt.c 1998/03/18 10:51:57 1.96
--- pt.c 1998/03/18 19:03:16
*************** check_explicit_specialization (declarato
*** 975,981 ****
}
else if (DECL_STATIC_FUNCTION_P (tmpl)
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
! revert_static_member_fn (&decl, 0, 0);
/* Mangle the function name appropriately. Note that we do
not mangle specializations of non-template member
--- 975,984 ----
}
else if (DECL_STATIC_FUNCTION_P (tmpl)
&& DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
! {
! revert_static_member_fn (&decl, 0, 0);
! last_function_parms = TREE_CHAIN (last_function_parms);
! }
/* Mangle the function name appropriately. Note that we do
not mangle specializations of non-template member