public inbox for archer@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Sami Wagiaalla <swagiaal@redhat.com>
Cc: Project Archer <archer@sourceware.org>
Subject: Re: [RFC] Koenig lookup patch 2
Date: Thu, 27 Aug 2009 21:49:00 -0000	[thread overview]
Message-ID: <m3zl9lorki.fsf@fleche.redhat.com> (raw)
In-Reply-To: <4A969900.6040100@redhat.com> (Sami Wagiaalla's message of "Thu, 27 Aug 2009 10:32:32 -0400")

>>>>> "Sami" == Sami Wagiaalla <swagiaal@redhat.com> writes:

Tom> there were
Tom> some formatting issues and whatnot -- these have to be fixed but are
Tom> not very important overall.

This comment still applies.  Please fix the formatting problems.
I can list them if you want.

Tom> With the current code is there a need to have the values here?
Tom> Or could this be reverted to the trunk's approach?

Sami> This was my attempt of making the code a little more compact.

Ah, I see.. thanks.

Tom> Does this really do the right thing in the case where the call has
Tom> multiple arguments, each of which has a type from a different
Tom> namespace?  I don't understand how those would get added to the
Tom> overload set.

Sami> The overload resolution is performed by the remainder of the function
Sami> (find_overloaded_match) this is just to give a starting point. However,
Sami> as you suspected, find_overload_match assumes that all the overload
Sami> choices are within the same namespace. This is corrected in this patch.

I am still not convinced this is correct.

First, I think Koenig lookup looks in the namespaces of all the
"associated" classes of each arguments.  So, if you have an argument of
type one::A which inherits from two::B, I think Koenig lookup should
search both one:: and two::.  I don't see that in this patch.  (I didn't
look this up in the standard, so if I'm wrong about it, feel free to say
so :-)

Sami> +			  /* This could potentially be a an argument dependet

Typo, "dependent".

Sami> +			     lookup function (koenig).  */

Should capitalize Koenig.

Sami> +    if (sym == NULL && !lookup_minimal_symbol (tmp, NULL, NULL) && !is_a_field_of_this)

I think checking is_a_field_of_this is unneeded here.

Sami> +void
Sami> +find_adl_match (struct type **arg_types, int nargs,char *name,
Sami> +               struct symbol **symp)
Sami> +{
[...]
Sami> +  for (i = 1; i <= nargs; i++){
[...]
Sami> +      if ( fsym &&
Sami> +           find_overload_match(arg_types, nargs, name, 0,
Sami> +                              0, NULL, fsym,NULL, symp,NULL) == 0)

I am not sure this is correct either.

My understanding is that in Koenig lookup, all the functions found this
way are put into an overload set which is then subject to overload
resolution rules.  ("Top-level" functions found by ordinary lookup are
also put into this set.)

In this code, I think you are just searching each namespace separately
for the best overload.  This seems like it could yield the wrong answer
in some cases (or at least, yield an answer when in fact the request is
ambiguous).

Tom

  reply	other threads:[~2009-08-27 21:49 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-03-13 19:58 [RFC] Koenig lookup patch Sami Wagiaalla
2009-03-13 22:10 ` Tom Tromey
2009-03-17 18:39   ` Sami Wagiaalla
2009-03-17 21:25     ` Tom Tromey
2009-04-29 15:51   ` [RFC] Koenig lookup patch 2 Sami Wagiaalla
2009-04-30  0:19     ` Tom Tromey
2009-08-27 14:35       ` Sami Wagiaalla
2009-08-27 21:49         ` Tom Tromey [this message]
2009-10-14 20:29           ` [RFC] Koenig lookup patch 3 Sami Wagiaalla
2009-10-14 21:01             ` Sami Wagiaalla
2009-10-15 20:48               ` Tom Tromey
2009-11-02 19:11                 ` Sami Wagiaalla
2009-11-09 19:29                   ` Tom Tromey
2009-11-17 16:04                     ` Sami Wagiaalla
2009-11-17 20:51                       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m3zl9lorki.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=archer@sourceware.org \
    --cc=swagiaal@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).