From 78abea278bf8ce0d6cf3735e5306f2644abbc643 Mon Sep 17 00:00:00 2001 From: Roger Sayle Date: Sun, 7 Jul 2002 18:56:18 +0000 Subject: [PATCH] error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for constructor and destructor tests when... * error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for constructor and destructor tests when passed a TEMPLATE_DECL. * g++.dg/template/qualttp21.C: New test case. From-SVN: r55304 --- gcc/cp/ChangeLog | 5 +++++ gcc/cp/error.c | 3 +++ gcc/testsuite/ChangeLog | 7 ++++++- gcc/testsuite/g++.dg/template/qualttp21.C | 17 +++++++++++++++++ 4 files changed, 31 insertions(+), 1 deletion(-) create mode 100644 gcc/testsuite/g++.dg/template/qualttp21.C diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 1c4b06d9943..72eb66033c5 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2002-07-07 Roger Sayle + + * error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for + constructor and destructor tests when passed a TEMPLATE_DECL. + 2002-07-05 Jason Merrill * cvt.c (cp_convert_to_pointer): Call force_fit_type for null diff --git a/gcc/cp/error.c b/gcc/cp/error.c index 678ffd081fb..8bef22c4536 100644 --- a/gcc/cp/error.c +++ b/gcc/cp/error.c @@ -1236,6 +1236,9 @@ dump_function_name (t, flags) { tree name = DECL_NAME (t); + if (TREE_CODE (t) == TEMPLATE_DECL) + t = DECL_TEMPLATE_RESULT (t); + /* Don't let the user see __comp_ctor et al. */ if (DECL_CONSTRUCTOR_P (t) || DECL_DESTRUCTOR_P (t)) diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index 0d8df23b43c..8a1273e0046 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,9 +1,14 @@ +2002-07-07 Roger Sayle + + * g++.dg/template/qualttp21.C: New test case. + 2002-07-06 Alexandre Oliva * gcc.c-torture/compile/20020706-1.c: New test. * gcc.c-torture/compile/20020706-2.c: New test. -2002-07-06 Brian R. Gaeke , Alexandre Oliva +2002-07-06 Brian R. Gaeke + Alexandre Oliva * g++.dg/warn/incomplete1.C: New test. diff --git a/gcc/testsuite/g++.dg/template/qualttp21.C b/gcc/testsuite/g++.dg/template/qualttp21.C new file mode 100644 index 00000000000..00fcf40c45c --- /dev/null +++ b/gcc/testsuite/g++.dg/template/qualttp21.C @@ -0,0 +1,17 @@ +// Copyright (C) 2002 Free Software Foundation +// Contributed by Roger Sayle +// { dg-do compile } + +template +class foo { + int _foo; +public: + foo() {} +protected: + ~foo() {} // { dg-error "~foo" } +}; + +int main() +{ + foo a; // { dg-error "context" } +}