From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 914 invoked by alias); 14 Oct 2009 19:17:20 -0000 Received: (qmail 903 invoked by uid 22791); 14 Oct 2009 19:17:19 -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; Wed, 14 Oct 2009 19:17:14 +0000 Received: from nan.false.org (localhost [127.0.0.1]) by nan.false.org (Postfix) with ESMTP id 7243A10EAC; Wed, 14 Oct 2009 19:19:10 +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 4FBD01072B; Wed, 14 Oct 2009 19:19:10 +0000 (GMT) Received: from drow by caradoc.them.org with local (Exim 4.69) (envelope-from ) id 1My9LS-00012r-3e; Wed, 14 Oct 2009 15:17:10 -0400 Date: Wed, 14 Oct 2009 19:17:00 -0000 From: Daniel Jacobowitz To: Tom Tromey Cc: Keith Seitz , gdb-patches@sourceware.org Subject: Re: [RFA] Add method overload resolution to expression parser Message-ID: <20091014191710.GA1785@caradoc.them.org> Mail-Followup-To: Tom Tromey , Keith Seitz , gdb-patches@sourceware.org References: <4A9D628B.1070300@redhat.com> <20091013212426.GA26169@caradoc.them.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: 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-10/txt/msg00313.txt.bz2 On Wed, Oct 14, 2009 at 12:54:15PM -0600, Tom Tromey wrote: > This implementation defers creation of the temporary function type to > the point where it is used. IIUC, which I hope I do :-), this temporary > type can't really leak out of the TYPE_INSTANCE code. That is, it is > constructed and used to look up an actual function or method (which has > its own type). > > If we used UNOP_CAST then we would have to make a long-lived temporary > type, not only because the type would have to live at least from parsing > through the end of the life of the parsed expression, but also because > the result of the cast would have that temporary type, and thus it would > be capturable. > > This would not be as big a deal if the type GC work were finished, but > that is still pending. Maybe we need to get that merged, then, instead of complicated lifetime-confusing hacks around it :-) We already have related bugs (and memory leaks). Try: (gdb) ptype (int (*) (int, int)) 0 type = int (*)() We lose the arguments - but we still call make_function_type, and leak the type. So it's clear to me that we want a more general solution. -- Daniel Jacobowitz CodeSourcery