This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix for tesecase g++.oliva/template5.C
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Fix for tesecase g++.oliva/template5.C
- From: Kriang Lerdsuwanakij <lerdsuwa at scf dot usc dot edu>
- Date: Thu, 16 Nov 2000 01:17:07 -0800 (PST)
Hi
The following patch fix a bug when checking whether a template
is instantiated using types with no linkage. Too many types of
tree nodes are checked by ANON_AGGR_NAME_P. These include
template parameters, TYPENAME_TYPE, etc. They can be safely
ignore. The failure of the g++.oliva/template5.C testcase is
due to checking unnamed template parameters and segfault since
its TYPE_IDENTIFIER is NULL. The patch changes IS_AGGR_TYPE
to CLASS_TYPE_P so that only the intended cases (struct, class,
union and enum) are checked.
--Kriang
=============
2000-11-16 Kriang Lerdsuwanakij <lerdsuwa@users.sourceforge.net>
* tree.c (no_linkage_helper): Use CLASS_TYPE_P instead of
IS_AGGR_TYPE.
diff -cprN gcc-old/cp/tree.c gcc/cp/tree.c
*** gcc-old/cp/tree.c Thu Nov 16 01:02:01 2000
--- gcc/cp/tree.c Thu Nov 16 01:01:54 2000
*************** no_linkage_helper (tp, walk_subtrees, da
*** 1545,1551 ****
tree t = *tp;
if (TYPE_P (t)
! && (IS_AGGR_TYPE (t) || TREE_CODE (t) == ENUMERAL_TYPE)
&& (decl_function_context (TYPE_MAIN_DECL (t))
|| ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))))
return t;
--- 1545,1551 ----
tree t = *tp;
if (TYPE_P (t)
! && (CLASS_TYPE_P (t) || TREE_CODE (t) == ENUMERAL_TYPE)
&& (decl_function_context (TYPE_MAIN_DECL (t))
|| ANON_AGGRNAME_P (TYPE_IDENTIFIER (t))))
return t;
diff -cprN gcc-old/testsuite/g++.old-deja/g++.oliva/template5.C gcc/testsuite/g++.old-deja/g++.oliva/template5.C
*** gcc-old/testsuite/g++.old-deja/g++.oliva/template5.C Thu Nov 16 01:03:03 2000
--- gcc/testsuite/g++.old-deja/g++.oliva/template5.C Thu Nov 16 01:03:11 2000
***************
*** 5,12 ****
// by Alexandre Oliva <oliva@dcc.unicamp.br>
// simplified from bug report by Andrey Slepuhin <pooh@msu.ru>
- // crash test - XFAIL *-*-*
-
template <typename> class X {
template <typename> class Z;
};
--- 5,10 ----