This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug c++/13064] New: getting address of a virtual base before its construction causes a crash


The following program compiles but crashes at runtime.

=== test.cpp ===
struct A {};

struct B : virtual public A
{
        B(A*) {}
};

struct C
{
        C() : b(&b) {}
        B b;
};

int main()
{
        new C;
}
=========

Command line:
g++ -Wall test.cpp

-- 
           Summary: getting address of a virtual base before its
                    construction causes a crash
           Product: gcc
           Version: 3.3.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: joseph at dkd dot lt
                CC: gcc-bugs at gcc dot gnu dot org
 GCC build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]