This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


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

Re: koenig lookup in C++




jason@redhat.com said:
> The standard doesn't seem to say anything about the case of an
> overloaded function, much less templates.  It seems to me that either
> we should not process any of the overloaded functions, or we should
> process all of them, and handle non-dependent parts of the signature
> of a function template the same way.
> The latter seems more useful. 

Then, maybe the first version of the patch I submitted is better even 
if frankly I'm not so sure whether it fulfills all the requirements 
you mention (but it should). The reference of the patch is:
http://gcc.gnu.org/ml/gcc-patches/2000-06/msg00781.html
Mark's comments for this patch are in:
http://gcc.gnu.org/ml/gcc-patches/2000-06/msg00836.html

Should we submit this problem to comp.std.c++ to get some consensus ???
There has been a thread somewhat related to this problem but I have not seen a 
definitive answer:
http://www.deja.com/[ST_rn=ps]/viewthread.xp?AN=648296191&search=thread&recnum=%3c3975935e@news.isb.net%3e%231/1&group=comp.std.c%2b%2b&frpage=viewthread.xp

The only thing that I would like to ensure is that taking the address of 
a function (given its prototype as in the koenig7.C case or by 
affecting it to a variable of the proper type) or calling a
function leads to the same behaviour from the compiler (ie selects 
the same function). 

One easy way to achieve this would be to consider 
a fake call to the overloaded templated function f2 with parameters of 
the type specified in the function's prototype (the type of the parameter
of g taking Geoff example's notations) and to add the namespace of the selected
function. Since the function f2 is supposed to be called by the g function, 
that would lead to the most sensible behavior. I wonder whether this
is exactly equivalent to your proposal....

jason@redhat.com said:
>>   What is misleading is that template argument deduction is 
>>   certainly authorized for function call... 

> Except that lookup happens before deduction. 

Oups, I was not aware of that... 
The fake function call proposal above in effect seem to mix lookup 
and deduction as template argument deduction can be made for function
parameters during the lookup. But again, it might be a complex way to do
exactly what your proposal already achieves...

	Theo.

--------------------------------------------------------------------
Theodore Papadopoulo
Email: Theodore.Papadopoulo@sophia.inria.fr Tel: (33) 04 92 38 76 01
 --------------------------------------------------------------------



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