From f3368a9098c3aa67ef422208978bf8df6353bc5a Mon Sep 17 00:00:00 2001 From: Nathan Sidwell Date: Sat, 29 Dec 2001 17:12:55 +0000 Subject: [PATCH] re PR c++/5125 (both g++ 3.0.1 and 2.95.3 crash with internal error when trying compile template method with parameter pointer to method) cp: PR c++/5125 * pt.c (push_template_decl_real): Make sure DECL has DECL_LANG_SPECIFIC. testsuite: * g++.dg/template/crash1.C: New test. From-SVN: r48370 --- gcc/cp/ChangeLog | 6 ++++++ gcc/cp/pt.c | 2 +- gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/g++.dg/template/crash1.C | 17 +++++++++++++++++ 4 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/crash1.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 77d4c5dcff3..b9101957bfc 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,9 @@ +2001-12-29 Nathan Sidwell + + PR c++/5125 + * pt.c (push_template_decl_real): Make sure DECL has + DECL_LANG_SPECIFIC. + 2001-12-29 Nathan Sidwell PR c++/335 diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c index cd43d4cabd6..de24a05f619 100644 --- a/gcc/cp/pt.c +++ b/gcc/cp/pt.c @@ -2627,7 +2627,7 @@ push_template_decl_real (decl, is_friend) return decl; } } - else if (! DECL_TEMPLATE_INFO (decl)) + else if (!DECL_LANG_SPECIFIC (decl) || !DECL_TEMPLATE_INFO (decl)) { error ("template definition of non-template `%#D'", decl); return decl; diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 89cf0251068..91fd37d2756 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2001-12-29 Nathan Sidwell + + * g++.dg/template/crash1.C: New test. + 2001-12-29 Nathan Sidwell * g++.dg/other/const1.C: New test. diff --git a/gcc/testsuite/g++.dg/template/crash1.C b/gcc/testsuite/g++.dg/template/crash1.C new file mode 100644 index 00000000000..27e89641ac7 --- /dev/null +++ b/gcc/testsuite/g++.dg/template/crash1.C @@ -0,0 +1,17 @@ +// { dg-do compile } + +// Copyright (C) 2001 Free Software Foundation, Inc. +// Contributed by Nathan Sidwell 29 Dec 2001 + +// PR 5125. ICE + +class S +{ + public: + template void Foo(int (*f)(S& o) ); // { dg-error "candidate" "" } +}; + +template +void S::Foo(int (*f)(TYPO&o) ) +{ // { dg-error "template definition of non-template|prototype" "" } +} -- 2.30.2