This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: PR 8372
- From: Mark Mitchell <mark at codesourcery dot com>
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 10 Dec 2002 14:30:27 -0800
- Subject: C++ PATCH: PR 8372
- Reply-to: mark at codesourcery dot com
This patch fixes PR 8372. The new parser branch handles destructor
names much more cleanly, but I don't want to try to move that code
into 3.2/3.3.
Tested on i686-pc-linux-gnu, applied on the mainline and on the
branch.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2002-12-10 Mark Mitchell <mark@codesourcery.com>
PR c++/8372
* pt.c (tsubst_copy): Handle destructor names more correctly.
2002-12-10 Mark Mitchell <mark@codesourcery.com>
PR c++/8372
* g++.dg/template/dtor1.C: New test.
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.634
diff -c -5 -p -r1.634 pt.c
*** cp/pt.c 1 Dec 2002 20:46:05 -0000 1.634
--- cp/pt.c 10 Dec 2002 22:29:27 -0000
*************** tsubst_copy (t, args, complain, in_decl)
*** 7231,7243 ****
else if (TREE_CODE (name) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR)
{
tree base = tsubst_copy (TREE_OPERAND (name, 0), args,
complain, in_decl);
! name = TREE_OPERAND (name, 1);
! name = tsubst_copy (TREE_OPERAND (name, 0), args,
! complain, in_decl);
name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
name = build_nt (SCOPE_REF, base, name);
}
else
name = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl);
--- 7231,7244 ----
else if (TREE_CODE (name) == SCOPE_REF
&& TREE_CODE (TREE_OPERAND (name, 1)) == BIT_NOT_EXPR)
{
tree base = tsubst_copy (TREE_OPERAND (name, 0), args,
complain, in_decl);
! name = TREE_OPERAND (TREE_OPERAND (name, 1), 0);
! if (TREE_CODE (name) == TYPE_DECL)
! name = TREE_TYPE (name);
! name = tsubst_copy (name, args, complain, in_decl);
name = build1 (BIT_NOT_EXPR, NULL_TREE, name);
name = build_nt (SCOPE_REF, base, name);
}
else
name = tsubst_copy (TREE_OPERAND (t, 0), args, complain, in_decl);
Index: testsuite/g++.dg/template/dtor1.C
===================================================================
RCS file: testsuite/g++.dg/template/dtor1.C
diff -N testsuite/g++.dg/template/dtor1.C
*** /dev/null 1 Jan 1970 00:00:00 -0000
--- testsuite/g++.dg/template/dtor1.C 10 Dec 2002 22:29:29 -0000
***************
*** 0 ****
--- 1,8 ----
+ struct A {};
+
+ template <typename T> struct B
+ {
+ B() { A().A::~A(); }
+ };
+
+ B<void> b;