From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 4760 invoked by alias); 28 Nov 2010 04:24:08 -0000 Received: (qmail 4615 invoked by uid 22791); 28 Nov 2010 04:24:05 -0000 X-SWARE-Spam-Status: No, hits=-2.8 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from localhost (HELO gcc.gnu.org) (127.0.0.1) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 28 Nov 2010 04:24:01 +0000 From: "hstong at ca dot ibm.com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/46687] Class member lookup ambiguity w/ overloaded static members and using declarations X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Keywords: accepts-invalid, rejects-valid, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: hstong at ca dot ibm.com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated Content-Type: text/plain; charset="UTF-8" MIME-Version: 1.0 Date: Sun, 28 Nov 2010 09:35:00 -0000 Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2010-11/txt/msg03411.txt.bz2 http://gcc.gnu.org/bugzilla/show_bug.cgi?id=46687 --- Comment #3 from Hubert Tong 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.