OSDN Git Service

cp:
authornathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 14 Sep 2002 23:19:48 +0000 (23:19 +0000)
committernathan <nathan@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 14 Sep 2002 23:19:48 +0000 (23:19 +0000)
PR c++/7768
* pt.c (build_template_decl): Copy DECL_DESTRUCTOR_P.
testsuite:
* g++.dg/template/pretty1.C: New test

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@57152 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/cp/ChangeLog
gcc/cp/pt.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/pretty1.C [new file with mode: 0644]

index bbdbef0..b8051cc 100644 (file)
@@ -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.
index e05174f..12c420a 100644 (file)
@@ -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))
index 97a4325..6bab83d 100644 (file)
@@ -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 (file)
index 0000000..99cbcd6
--- /dev/null
@@ -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;
+}