From 366c0f1ec0f31bc82af70722dc1f28b14808546b Mon Sep 17 00:00:00 2001 From: Mark Mitchell Date: Thu, 19 Mar 1998 09:08:53 +0000 Subject: [PATCH] pt.c (check_explicit_specialization): When reverting a static member function... * 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 | 6 ++++++ gcc/cp/pt.c | 5 ++++- gcc/testsuite/g++.old-deja/g++.pt/static1.C | 21 +++++++++++++++++++++ 3 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.old-deja/g++.pt/static1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 45e0de07a09..2fe1fa932b0 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +Wed Mar 19 09:08:12 1998 Mark Mitchell + + * 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 * pt.c (tsubst_copy, CONST_DECL): Don't bother tsubsting diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index 7609ee51c55..1bd8dbb904f 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -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 index 00000000000..67e23631600 --- /dev/null +++ b/gcc/testsuite/g++.old-deja/g++.pt/static1.C @@ -0,0 +1,21 @@ +extern "C" void abort(); + +template +class A +{ + public: + static int foo(int); +}; + +template <> +int A::foo(int i) +{ + return i; +} + + +int main() +{ + if (A::foo(22) != 22) + abort(); +} -- 2.30.2