error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for constructor and destructor...
authorRoger Sayle <sayle@gcc.gnu.org>
Sun, 7 Jul 2002 18:56:18 +0000 (18:56 +0000)
committerRoger Sayle <sayle@gcc.gnu.org>
Sun, 7 Jul 2002 18:56:18 +0000 (18:56 +0000)
* 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
gcc/cp/error.c
gcc/testsuite/ChangeLog
gcc/testsuite/g++.dg/template/qualttp21.C [new file with mode: 0644]

index 1c4b06d994304ae3895357430fa96fe051cca7a4..72eb66033c53d908fa9d5ad24b0cb93e67237905 100644 (file)
@@ -1,3 +1,8 @@
+2002-07-07  Roger Sayle  <roger@eyesopen.com>
+
+       * error.c (dump_function_name): Use DECL_TEMPLATE_RESULT for
+       constructor and destructor tests when passed a TEMPLATE_DECL.
+
 2002-07-05  Jason Merrill  <jason@redhat.com>
 
        * cvt.c (cp_convert_to_pointer): Call force_fit_type for null
index 678ffd081fb825bea310b903af846275d3abf16e..8bef22c45364ba6c86431b90842695ad1d814184 100644 (file)
@@ -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))
index 0d8df23b43cc66f9a8de681fc7a335944da9c402..8a1273e0046b217229783800aa38d55207c4c6bc 100644 (file)
@@ -1,9 +1,14 @@
+2002-07-07  Roger Sayle  <roger@eyesopen.com>
+
+       * g++.dg/template/qualttp21.C: New test case.
+
 2002-07-06  Alexandre Oliva  <aoliva@redhat.com>
 
        * gcc.c-torture/compile/20020706-1.c: New test.
        * gcc.c-torture/compile/20020706-2.c: New test.
 
-2002-07-06  Brian R. Gaeke  <brg@dgate.ORG>, Alexandre Oliva  <aoliva@redhat.com>
+2002-07-06  Brian R. Gaeke  <brg@dgate.ORG>
+           Alexandre Oliva  <aoliva@redhat.com>
 
        * 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 (file)
index 0000000..00fcf40
--- /dev/null
@@ -0,0 +1,17 @@
+// Copyright (C) 2002 Free Software Foundation
+// Contributed by Roger Sayle <roger@eyesopen.com>
+// { dg-do compile }
+
+template <class A>
+class foo {
+   int _foo;
+public:
+   foo() {}
+protected:
+   ~foo() {} // { dg-error "~foo" }
+};
+
+int main()
+{
+  foo<int> a; // { dg-error "context" }
+}