From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16024 invoked by alias); 26 May 2006 22:50:52 -0000 Received: (qmail 15969 invoked by uid 48); 26 May 2006 22:50:46 -0000 Date: Fri, 26 May 2006 22:50:00 -0000 Subject: [Bug c++/27775] New: incorrect "ambiguous" error message with multiple inheritance and nested class. X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "rnewman at compubrite dot com" Mailing-List: contact gcc-bugs-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Archive: List-Post: List-Help: Sender: gcc-bugs-owner@gcc.gnu.org X-SW-Source: 2006-05/txt/msg02743.txt.bz2 List-Id: The test-case: // testcase: ------------------------- struct A { struct B { }; }; struct C : A, A::B { void foo(B b); void bar(B* pb); }; //------------------------------------ ============== The error: foo.cc:11: error: reference to 'B' is ambiguous foo.cc:5: error: candidates are: struct A::B foo.cc:5: error: struct A::B foo.cc:11: error: 'B' has not been declared foo.cc:12: error: reference to 'B' is ambiguous foo.cc:5: error: candidates are: struct A::B foo.cc:5: error: struct A::B foo.cc:12: error: 'B' has not been declared ------------- There is only one type "B", whether it's referred to as ::A::B, (from the global scope), or "A::B", injected from the first inheritance, or simpy "B" injected from the second. These all refer to the same type. There is no ambiguity. Note, GCC accepts this if the "foo" member functions are delcared w/ namespace qualification. For example, this code is accepted: struct C : A, A::B { void foo(A::B b); void bar(A::B* pb); }; ================= This behaviour is found in the following versions of GCC: egcs-2.91.66, gcc-3.2, gcc-3.3, gcc-3.4.3, gcc-3.4.6, gcc-4.0 I haven't tried other versions. -- Summary: incorrect "ambiguous" error message with multiple inheritance and nested class. Product: gcc Version: 4.0.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: rnewman at compubrite dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=27775