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

             Bug #: 54590
           Summary: Incorrect multi-inheritence bases layout
    Classification: Unclassified
           Product: gcc
           Version: 4.7.1
            Status: UNCONFIRMED
          Severity: major
          Priority: P3
         Component: c++
        AssignedTo: unassig...@gcc.gnu.org
        ReportedBy: wingf...@gmail.com


the code:

#include <iostream>

struct A{ virtual void foo() {} };                                              

struct B { void * data; };

struct X : public B, A { };

int main(){

    X x;
    if((void*)&x == (void*)(&x.data))
        std::cout << "correct\n";
    else
        std::cout << "oops...\n";
    return 0;
}

Expect:
print "correct"

Result:
print "oops..."

Notes:
if A::foo is not virtual, the result is correct.

Reply via email to