This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix bug 1844
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Fix bug 1844
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Fri, 20 Apr 2001 17:07:28 +0100
- Organization: Codesourcery LLC
Hi,
I've installed this patch on both mainline and 3.0 branch. It fixes
bug 1844.
We can meet all sorts of type nodes via a template id expr.
built & tested on i686-pc-linux-gnu, approved by Mark.
nathan
--
Dr Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
'But that's a lie.' - 'Yes it is. What's your point?'
nathan@codesourcery.com : http://www.cs.bris.ac.uk/~nathan/ : nathan@acm.org
2001-04-12 Nathan Sidwell <nathan@codesourcery.com>
* tree.c (cp_tree_equal): Adjust final switch formatting. Add
't' case.
Index: cp/tree.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/tree.c,v
retrieving revision 1.232.2.5
diff -c -3 -p -r1.232.2.5 tree.c
*** tree.c 2001/03/23 00:46:09 1.232.2.5
--- tree.c 2001/04/12 08:26:21
*************** cp_tree_equal (t1, t2)
*** 2007,2027 ****
switch (TREE_CODE_CLASS (code1))
{
- int i;
case '1':
case '2':
case '<':
case 'e':
case 'r':
case 's':
! cmp = 1;
! for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
! {
! cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
! if (cmp <= 0)
! return cmp;
! }
! return cmp;
}
return -1;
--- 2007,2033 ----
switch (TREE_CODE_CLASS (code1))
{
case '1':
case '2':
case '<':
case 'e':
case 'r':
case 's':
! {
! int i;
!
! cmp = 1;
! for (i = 0; i < TREE_CODE_LENGTH (code1); ++i)
! {
! cmp = cp_tree_equal (TREE_OPERAND (t1, i), TREE_OPERAND (t2, i));
! if (cmp <= 0)
! return cmp;
! }
! return cmp;
! }
!
! case 't':
! return same_type_p (t1, t2) ? 1 : 0;
}
return -1;
// Build don't link:
//
// Origin: Jens.Maurer@gmx.net
// Copyright (C) 2001 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 11 Apr 2001 <nathan@codesourcery.com>
// Bug 1844. We can meet types in cp_tree_equal via a template-id-expr.
typedef int *Ptr;
template<class T> struct B
{
typedef typename T::template X<T> type;
typedef typename T::template X<Ptr> type2;
typedef typename T::template X<int *> type3;
void foo (type);
void baz (type2);
};
template<class T> void B<T>::foo (type)
{
}
template<class T> void B<T>::baz (type3)
{
}