This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
[C++ PATCH] Fix bug 1728
- To: gcc-patches at gcc dot gnu dot org
- Subject: [C++ PATCH] Fix bug 1728
- From: Nathan Sidwell <nathan at codesourcery dot com>
- Date: Tue, 23 Jan 2001 10:48:06 +0000
- Organization: Codesourcery LLC
Hi,
I've installed the attached patch which fixes the incredibly fragile
assumption that DECL_LANG_SPECIFIC (decl) == NULL had some semantic meaning.
At 7 members we add a sorted array into DECL_LANG_SPECIFIC, making it
non-null!
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-01-22 Nathan Sidwell <nathan@codesourcery.com>
* decl.c (grokdeclarator): Don't presume DECL_LANG_SPECIFIC
indicates anything special about template depth. Make sure we
only count the user visible template classes.
Index: cp/decl.c
===================================================================
RCS file: /cvs/gcc/egcs/gcc/cp/decl.c,v
retrieving revision 1.739
diff -c -3 -p -r1.739 decl.c
*** decl.c 2001/01/19 09:24:12 1.739
--- decl.c 2001/01/22 16:43:09
*************** grokdeclarator (declarator, declspecs, d
*** 10807,10820 ****
the definition of `S<int>::f'. */
if (CLASSTYPE_TEMPLATE_INFO (t)
&& (CLASSTYPE_TEMPLATE_INSTANTIATION (t)
! || uses_template_parms (CLASSTYPE_TI_ARGS (t))))
template_count += 1;
t = TYPE_MAIN_DECL (t);
! if (DECL_LANG_SPECIFIC (t))
! t = DECL_CONTEXT (t);
! else
! t = NULL_TREE;
}
if (sname == NULL_TREE)
--- 10807,10818 ----
the definition of `S<int>::f'. */
if (CLASSTYPE_TEMPLATE_INFO (t)
&& (CLASSTYPE_TEMPLATE_INSTANTIATION (t)
! || uses_template_parms (CLASSTYPE_TI_ARGS (t)))
! && PRIMARY_TEMPLATE_P (CLASSTYPE_TI_TEMPLATE (t)))
template_count += 1;
t = TYPE_MAIN_DECL (t);
! t = DECL_CONTEXT (t);
}
if (sname == NULL_TREE)
// Build don't link:
//
// Copyright (C) 2000 Free Software Foundation, Inc.
// Contributed by Nathan Sidwell 21 Jan 2001 <nathan@codesourcery.com>
// Bug 1728. We started sorting things when there were 7 fields. Our
// template_count algorithm was rather fragile ...
template <int dim> struct X
{
struct Y
{
int x1;
int x2;
int x3;
int x4;
int x5;
int x6;
int x7;
void Foo ();
};
};
template <> void X<1>::Y::Foo () {}