Diamond shaped class structure with a covariant return method causes GCC to
fail to adjust base pointers.  In the attached program, the output is a huge
number instead of the expected 123.

Looking at what happens in GDB, it appears that the this pointer in the call of
A(const A &other) gets a B reference rather than an A reference.  The place
where it expects to find the member A::a is actually outside of the object of
type F.  If I'm reading the output from GDB correctly.


-- 
           Summary: Diamond virtual inheritence with covariant return type
                    confuses GCC
           Product: gcc
           Version: 4.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: goeran at uddeborg dot se


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

Reply via email to