This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFA] "Sort" C++ fieldlists
- From: Daniel Jacobowitz <drow at false dot org>
- To: Keith Seitz <keiths at redhat dot com>
- Cc: gdb-patches at sourceware dot org
- Date: Fri, 4 Dec 2009 08:51:35 -0500
- Subject: Re: [RFA] "Sort" C++ fieldlists
- References: <4B187211.8070004@redhat.com>
On Thu, Dec 03, 2009 at 06:21:05PM -0800, Keith Seitz wrote:
> Hi,
>
> My method overload resolution patch was committed with the following
> comment (from value_struct_elt_for_reference):
>
> /* This assumes, of course, that all artificial methods appear
> BEFORE any concrete methods. */
>
> Turns out that isn't a really great assumption. In particular, it
> fails on GCC 3.4.6. So I'm requesting that the attached patch be
> approved. The patch inserts artificial methods into the type's
> fieldlist starting at index 0 and concrete methods starting at the
> end index.
>
> This shows no regressions (and no advantages) using GCC on linux.
> However, if you run cpexprs.exp, this patch will fix 17 failures with
> GCC 3.4.6. At the worst, consider this a defensive patch against
> breaking the value_struct_elt_for_reference assumption.
I guess this is OK... it seems nicer not to impose the restriction.
Is it this easy?
int ii;
j = -1;
for (ii = 0; ii < TYPE_FN_FIELDLIST_LENGTH (t, i);
++ii)
{
/* Skip artificial methods. This is necessary if, for example,
the user wants to "print subclass::subclass" with only
one user-defined constructor. There is no ambiguity in this
case. */
if (TYPE_FN_FIELD_ARTIFICIAL (f, ii))
continue;
/* Desired method is ambiguous if more than one method is
defined. */
if (j != -1)
error (_("non-unique member `%s' requires type instantiation"), name);
j = ii;
}
--
Daniel Jacobowitz
CodeSourcery