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: [patch 1/3] Template Lookup



Sami> Same patch but using prepare_for_testing

Thanks.


Thanks for the review.


I suspect this doesn't interact properly with psymtabs, because from
what I can tell the template-argument-less symbol is only entered for
full symbols, not partial symbols.  This means that a reference to some
function will not work properly until the psymtab is expanded for some
other reason.


Hmm.. can you give me an example of this ? I tried to construct an example with an extern function but I learned that cplus does not allow extern template functions.


Sami> +gdb_test_no_output "set language c++" ""

There are a couple instances of this that have to be updated in light of
Doug's recent change to how this is done.


What is the change that Doug made ?


Sami>  @@ -2458,7 +2458,7 @@ find_overload_match (struct type **arg_types, int nargs,
Sami>         if (fsym)
Sami>           {
Sami>  -          qualified_name = SYMBOL_NATURAL_NAME (fsym);
Sami>  +          qualified_name = SYMBOL_SEARCH_NAME (fsym);

It took me a while to understand why this could be work.

It seems to me that it is not completely right though. Consider this case:

     template<int X>  int f (int x) { return x + X; }
     int compute (int x) { return f<5>  (x) + f<7>  (x); }

In this situation you can't just look at overloads of "f" -- it is
ambiguous.  You have to do more analysis.


This can be blamed on find_overload_match's inability to deal with ambiguous resolution. Removing the template parameter actually makes it easier for find_overload_match to handle this situation if/when it supports the ambiguous case. It enables find_overload_match to print a message about ambiguous overload resolution instead of just "symbol not found". Of course p f<5>() and p f<7>() still works correctly.



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