public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
* [Bug c++/27775]  New: incorrect "ambiguous" error message with multiple inheritance and nested class.
@ 2006-05-26 22:50 rnewman at compubrite dot com
  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
  0 siblings, 2 replies; 3+ messages in thread
From: rnewman at compubrite dot com @ 2006-05-26 22:50 UTC (permalink / raw)
  To: gcc-bugs

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


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2008-08-10  9:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-26 22:50 [Bug c++/27775] New: incorrect "ambiguous" error message with multiple inheritance and nested class rnewman at compubrite dot com
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

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).