public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "rnewman at compubrite dot com" <gcc-bugzilla@gcc.gnu.org> To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/27775] New: incorrect "ambiguous" error message with multiple inheritance and nested class. Date: Fri, 26 May 2006 22:50:00 -0000 [thread overview] Message-ID: <bug-27775-8982@http.gcc.gnu.org/bugzilla/> (raw) 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
next reply other threads:[~2006-05-26 22:50 UTC|newest] Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top 2006-05-26 22:50 rnewman at compubrite dot com [this message] 2006-08-06 22:19 ` [Bug c++/27775] " bangerth at dealii dot org 2008-08-10 9:50 ` kristian dot spangsege at gmail dot com
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-27775-8982@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: linkBe 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).