]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
pt.c (check_explicit_specialization): When reverting a static member function...
authorMark Mitchell <mmitchell@usa.net>
Thu, 19 Mar 1998 09:08:53 +0000 (09:08 +0000)
committerMark Mitchell <mmitchel@gcc.gnu.org>
Thu, 19 Mar 1998 09:08:53 +0000 (09:08 +0000)
* pt.c (check_explicit_specialization): When reverting a static
member function, also remove the `this' parameter from
last_function_parms.

From-SVN: r18704

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/g++.old-deja/g++.pt/static1.C [new file with mode: 0644]

index 45e0de07a09485e5c4a67a482afbe4c1d102531a..2fe1fa932b0e1b5395dd74c2cf5bb2a5abd3ee1d 100644 (file)
@@ -1,3 +1,9 @@
+Wed Mar 19 09:08:12 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.
+
 Thu Mar 19 02:27:48 1998  Jason Merrill  <jason@yorick.cygnus.com>
 
        * pt.c (tsubst_copy, CONST_DECL): Don't bother tsubsting
index 7609ee51c55b633036065ceac8bb2b89a9800b4e..1bd8dbb904fd2bc9ebcd538b0f2ea012a45963cc 100644 (file)
@@ -975,7 +975,10 @@ check_explicit_specialization (declarator, decl, template_count, flags)
            }
          else if (DECL_STATIC_FUNCTION_P (tmpl)
                   && DECL_NONSTATIC_MEMBER_FUNCTION_P (decl))
-           revert_static_member_fn (&decl, 0, 0);
+           {
+             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
diff --git a/gcc/testsuite/g++.old-deja/g++.pt/static1.C b/gcc/testsuite/g++.old-deja/g++.pt/static1.C
new file mode 100644 (file)
index 0000000..67e2363
--- /dev/null
@@ -0,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();
+}