[Bug c++/54590] New: Incorrect multi-inheritence bases layout
wingfire at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sat Sep 15 14:08:00 GMT 2012
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: unassigned@gcc.gnu.org
ReportedBy: wingfire@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.
More information about the Gcc-bugs
mailing list