This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
C++ PATCH: Fix PR 199
- To: gcc-patches at gcc dot gnu dot org
- Subject: C++ PATCH: Fix PR 199
- From: Mark Mitchell <mark at codesourcery dot com>
- Date: Thu, 15 Feb 2001 23:59:22 -0800
- Organization: CodeSourcery, LLC
This patch fixes PR 199, a regression since GCC 2.95.2. For this
reason, I've applied the fix on both the branch and the mainline.
Tested on i686-pc-linux-gnu.
--
Mark Mitchell mark@codesourcery.com
CodeSourcery, LLC http://www.codesourcery.com
2001-02-15 Mark Mitchell <mark@codesourcery.com>
* pt.c (push_template_decl_real): Don't remangle the name of a
class template.
Index: testsuite/g++.old-deja/g++.pt/friend48.C
===================================================================
RCS file: friend48.C
diff -N friend48.C
*** /dev/null Tue May 5 13:32:27 1998
--- friend48.C Thu Feb 15 23:49:08 2001
***************
*** 0 ****
--- 1,17 ----
+ // Build don't link:
+ // Origin: Mark Mitchell <mark@codesourcery.com>
+
+ template <class T>
+ class C {
+ template <class U>
+ friend class ::C;
+ };
+
+ namespace N
+ {
+ template <class T>
+ class D {
+ template <class U>
+ friend class N::D;
+ };
+ };
Index: cp/pt.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/cp/pt.c,v
retrieving revision 1.516.2.2
diff -c -p -r1.516.2.2 pt.c
*** pt.c 2001/02/14 10:20:11 1.516.2.2
--- pt.c 2001/02/16 07:49:47
*************** push_template_decl_real (decl, is_friend
*** 2718,2724 ****
{
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
if ((!ctx || TREE_CODE (ctx) != FUNCTION_DECL)
! && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE)
DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl));
}
else if (DECL_LANG_SPECIFIC (decl))
--- 2718,2726 ----
{
SET_TYPE_TEMPLATE_INFO (TREE_TYPE (tmpl), info);
if ((!ctx || TREE_CODE (ctx) != FUNCTION_DECL)
! && TREE_CODE (TREE_TYPE (decl)) != ENUMERAL_TYPE
! /* Don't change the name if we've already set it up. */
! && !IDENTIFIER_TEMPLATE (DECL_NAME (decl)))
DECL_NAME (decl) = classtype_mangled_name (TREE_TYPE (decl));
}
else if (DECL_LANG_SPECIFIC (decl))