[Bug c++/32676] New: [cxx0x branch] incorrect member address when using delegate constructors and virtual inheritance
a dot chavasse at gmail dot com
gcc-bugzilla@gcc.gnu.org
Sun Jul 8 13:29:00 GMT 2007
version: g++0x (GCC) 4.3.0 20070628 (experimental)
(more exactly: branch svn://gcc.gnu.org/svn/gcc/branches/cxx0x-branch, svn
revision 126129)
system type: x86_64-unknown-linux-gnu
configured with: ../gcc0x/configure --program-suffix=0x --disable-multilib
--enable-languages=c,c++
The following code prints two different adresses for m_Count, whereas it should
print the same address twice.
It works properly when not calling the delegate constructor from A's default
constructor.
It also works properly if the "blah" array in B is removed or reduced to a size
of one.
====================================
#include <iostream>
class base
{
public:
virtual ~base() {}
int m_Count;
};
class A : public virtual base
{
public:
A( int blah ) {}
A() : A( 13245 )
{
std::cout << &m_Count << std::endl;
}
};
class B : public virtual base, public A
{
public:
B()
{
std::cout << &m_Count << std::endl;
}
private:
int blah[100];
};
int main()
{
B* pB = new B;
return 0;
}
=================================
--
Summary: [cxx0x branch] incorrect member address when using
delegate constructors and virtual inheritance
Product: gcc
Version: 4.3.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
AssignedTo: unassigned at gcc dot gnu dot org
ReportedBy: a dot chavasse at gmail dot com
GCC build triplet: x86_64-unknown-linux-gnu
GCC host triplet: x86_64-unknown-linux-gnu
GCC target triplet: x86_64-unknown-linux-gnu
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32676
More information about the Gcc-bugs
mailing list