public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "hstong at ca dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/46687] Class member lookup ambiguity w/ overloaded static members and using declarations
Date: Sun, 28 Nov 2010 09:35:00 -0000	[thread overview]
Message-ID: <bug-46687-4-HFkC1IJr9j@http.gcc.gnu.org/bugzilla/> (raw)
In-Reply-To: <bug-46687-4@http.gcc.gnu.org/bugzilla/>

http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46687

--- Comment #3 from Hubert Tong <hstong at ca dot ibm.com> 2010-11-28 04:23:55 UTC ---
(In reply to comment #2)
> However, because you have using declarations in B1 and B2 name lookup finds
> B1::foo and B2::foo ... at least by my reading, which could be wrong

It does find B1::foo and B2::foo, but then again, B1::foo and B2::foo refer to
the same functions. In the N3126 wording, the declaration sets for looking up
B1::foo and B2::foo are the same. I believe the case presented is valid under
both the C++03 and the N3126 wording.

>>>
C++03 subclause 10.2 [class.member.lookup] paragraph 2:
First, every declaration for the name in the class and in each of its base
class sub-objects is considered.
...
Each of these declarations that was introduced by a using-declaration is
considered to be from each sub-object of C that is of the type containing the
declaration designated by the using-declaration. If the resulting set of
declarations are not all from sub-objects of the same type, or the set has a
nonstatic member and includes members from distinct sub-objects, there is an
ambiguity and the program is ill-formed. Otherwise that set is the result of
the lookup.
<<<

My understanding is that the resulting set of declarations are all from
subobjects of the same type (the two subobjects, C::B1::A and C::B2::A) and the
set has no nonstatic members (all functions foo() are static member functions).
>From this paragraph, we have a set of declarations as the result of lookup:
{ ::A::foo(void), ::A::foo(char) }

Overload resolution then takes place.


  parent reply	other threads:[~2010-11-28  4:24 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-11-27 21:26 [Bug c++/46687] New: " hstong at ca dot ibm.com
2010-11-28  7:43 ` [Bug c++/46687] " redi at gcc dot gnu.org
2010-11-28  8:59 ` redi at gcc dot gnu.org
2010-11-28  9:35 ` hstong at ca dot ibm.com [this message]
2012-09-02 11:52 ` fabien at gcc dot gnu.org

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=bug-46687-4-HFkC1IJr9j@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /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).