Forget to say, I test it on Debian, X86_64, g++ 4.7.1

> I searched the ABI description in 
> http://mentorembedded.github.com/cxx-abi/cxx-vtable-ex.html & 
> http://www.phpcompiler.org/articles/virtualinheritance.html, and didn't found 
> the exactly description for the following case:
> 
> 
> 
> struct Foo{ virtual void foo() {} };
> 
> struct Bar{ virtual void bar() {} };
> 
> struct B { void* data; };
> 
> 
> 
> struct X : public B, Foo, Bar { };
> 
> 
> 
> I expected the memory order of bases is:
> 
> {
> 
> data of B;
> 
> vptr of Foo;
> 
> vptr of Bar;
> 
> }
> 
> 
> 
> but the actual result is:
> 
> {
> 
> vptr of Foo;
> 
> data of B;
> 
> vptr of Bar;
> 
> };
> 
> if both Foo and Bar has no virtual functions, the result would be:
> 
> {
> 
> data of B;
> 
> vptr of Foo;
> 
> vptr of Bar;
> 
> };
> 
> 
> 
> So, I can't judge the memory layout for the following code:
> 
> template<typename A, typename B, typename C>
> 
> struct Mix : public A, B, C {}
> 
> 
> 
> So, I want to know, is it a bug of gcc? Is the case clarified in any 
> standards?
> 
> 
> 
> Great thanks for any information.

_______________________________________________
help-gplusplus mailing list
help-gplusplus@gnu.org
https://lists.gnu.org/mailman/listinfo/help-gplusplus

Reply via email to