aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNathan Sidwell <nathan@codesourcery.com>2002-09-14 23:19:48 +0000
committerNathan Sidwell <nathan@gcc.gnu.org>2002-09-14 23:19:48 +0000
commitc8460010fab905e8441a1d15f859da8ffb6fceda (patch)
treed19375b92220e72e0657ab729b4ab108e103c8bd
parent981f97c3641ce62391dffab22c971266cbaa057b (diff)
downloadgcc-c8460010fab905e8441a1d15f859da8ffb6fceda.zip
gcc-c8460010fab905e8441a1d15f859da8ffb6fceda.tar.gz
gcc-c8460010fab905e8441a1d15f859da8ffb6fceda.tar.bz2
re PR c++/7768 (__PRETTY_FUNCTION__ for template destructor is wrong)
cp: PR c++/7768 * pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P. testsuite: * g++.dg/template/pretty1.C: New test From-SVN: r57152
-rw-r--r--gcc/cp/ChangeLog5
-rw-r--r--gcc/cp/pt.c1
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/g++.dg/template/pretty1.C43
4 files changed, 53 insertions, 0 deletions
diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog
index bbdbef0..b8051cc 100644
--- a/gcc/cp/ChangeLog
+++ b/gcc/cp/ChangeLog
@@ -1,3 +1,8 @@
+2002-09-14 Nathan Sidwell <nathan@codesourcery.com>
+
+ PR c++/7768
+ * pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P.
+
2002-09-14 Kazu Hirata <kazu@cs.umass.edu>
* error.c: Fix comment formatting.
diff --git a/gcc/cp/pt.c b/gcc/cp/pt.c
index e05174f..12c420a 100644
--- a/gcc/cp/pt.c
+++ b/gcc/cp/pt.c
@@ -2110,6 +2110,7 @@ build_template_decl (decl, parms)
DECL_VIRTUAL_CONTEXT (tmpl) = DECL_VIRTUAL_CONTEXT (decl);
DECL_STATIC_FUNCTION_P (tmpl) = DECL_STATIC_FUNCTION_P (decl);
DECL_CONSTRUCTOR_P (tmpl) = DECL_CONSTRUCTOR_P (decl);
+ DECL_DESTRUCTOR_P (tmpl) = DECL_DESTRUCTOR_P (decl);
DECL_NONCONVERTING_P (tmpl) = DECL_NONCONVERTING_P (decl);
DECL_ASSIGNMENT_OPERATOR_P (tmpl) = DECL_ASSIGNMENT_OPERATOR_P (decl);
if (DECL_OVERLOADED_OPERATOR_P (decl))
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 97a4325..6bab83d 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2002-09-15 Nathan Sidwell <nathan@codesourcery.com>
+
+ * g++.dg/template/pretty1.C: New test.
+
2002-09-14 Alan Modra <amodra@bigpond.net.au>
* gcc.c-torture/execute/struct-cpy-1.c: New test.
diff --git a/gcc/testsuite/g++.dg/template/pretty1.C b/gcc/testsuite/g++.dg/template/pretty1.C
new file mode 100644
index 0000000..99cbcd6
--- /dev/null
+++ b/gcc/testsuite/g++.dg/template/pretty1.C
@@ -0,0 +1,43 @@
+// { dg-do run }
+
+// Copyright (C) 2002 Free Software Foundation, Inc.
+// Contributed by Nathan Sidwell 14 Sep 2002 <nathan@codesourcery.com>
+
+// PR 7768 template dtor pretty function wrong
+
+#include <string.h>
+
+static size_t current = 0;
+static bool error = false;
+
+static char const *names[] =
+{
+ "X<T>::X() [with T = void]",
+ "X<T>::~X() [with T = void]",
+ 0
+};
+
+void Verify (char const *ptr)
+{
+ error = strcmp (ptr, names[current++]);
+}
+
+template <typename T>
+struct X
+{
+ X() { Verify (__PRETTY_FUNCTION__); }
+ ~X() { Verify (__PRETTY_FUNCTION__); }
+};
+
+int main()
+{
+ {
+ X<void> x;
+
+ if (error)
+ return current;
+ }
+ if (error)
+ return current;
+ return 0;
+}