From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 31323 invoked by alias); 19 Feb 2010 14:22:45 -0000 Received: (qmail 31277 invoked by uid 48); 19 Feb 2010 14:22:34 -0000 Date: Fri, 19 Feb 2010 14:22:00 -0000 Subject: [Bug c++/43120] New: Diamond virtual inheritence with covariant return type confuses GCC X-Bugzilla-Reason: CC Message-ID: Reply-To: gcc-bugzilla@gcc.gnu.org To: gcc-bugs@gcc.gnu.org From: "goeran at uddeborg dot se" 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-02/txt/msg01945.txt.bz2 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