This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFA] Add method overload resolution to expression parser


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]