From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13154 invoked by alias); 4 Dec 2009 20:54:51 -0000 Received: (qmail 13143 invoked by uid 22791); 4 Dec 2009 20:54:50 -0000 X-SWARE-Spam-Status: No, hits=-2.5 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from NaN.false.org (HELO nan.false.org) (208.75.86.248) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Dec 2009 20:54:45 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 93A5710A34; Fri, 4 Dec 2009 20:54:43 +0000 (GMT) Received: from caradoc.them.org (209.195.188.212.nauticom.net [209.195.188.212]) by nan.false.org (Postfix) with ESMTP id 733CB10548; Fri, 4 Dec 2009 20:54:43 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1NGfAo-0002Jt-JI; Fri, 04 Dec 2009 15:54:42 -0500 Date: Fri, 04 Dec 2009 20:54:00 -0000 From: Daniel Jacobowitz To: Keith Seitz Cc: gdb-patches@sourceware.org Subject: Re: [RFA] "Sort" C++ fieldlists Message-ID: <20091204205442.GA3736@caradoc.them.org> Mail-Followup-To: Keith Seitz , gdb-patches@sourceware.org References: <4B187211.8070004@redhat.com> <20091204135135.GA4909@caradoc.them.org> <4B194785.6090801@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4B194785.6090801@redhat.com> User-Agent: Mutt/1.5.20 (2009-06-14) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2009-12/txt/msg00065.txt.bz2 On Fri, Dec 04, 2009 at 09:31:49AM -0800, Keith Seitz wrote: > Yes, actually it *is* that simple. Or at least none of my testing can > prove that your (much) simpler patch is any less effective than my > more complicated one. I've tested and committed this, then. -- Daniel Jacobowitz CodeSourcery 2009-12-04 Daniel Jacobowitz * valops.c (value_struct_elt_for_reference): Do not rely on field order. Index: valops.c =================================================================== RCS file: /cvs/src/src/gdb/valops.c,v retrieving revision 1.228 diff -u -p -r1.228 valops.c --- valops.c 2 Dec 2009 19:29:42 -0000 1.228 +++ valops.c 4 Dec 2009 20:25:44 -0000 @@ -2700,29 +2700,31 @@ value_struct_elt_for_reference (struct t } if (j == len) - error (_("no member function matches that type instantiation")); } + error (_("no member function matches that type instantiation")); + } else { int 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. */ + + 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)) - --len; - } + continue; - /* Desired method is ambiguous if more than one method is - defined. */ - if (len > 1) - error (_("non-unique member `%s' requires type instantiation"), name); - - /* This assumes, of course, that all artificial methods appear - BEFORE any concrete methods. */ - j = TYPE_FN_FIELDLIST_LENGTH (t, i) - 1; + /* 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; + } } if (TYPE_FN_FIELD_STATIC_P (f, j))