Consider this testcase:

---
#include <stdlib.h>
#include <stdio.h>

struct A { 
  A() { printf("a\n"); exit(1); }
  ~A() { printf("~a\n"); }
} a;

struct B { 
  B() { printf("b\n"); }
  ~B() { printf("~b\n"); }
} b;
int main() {}
---

G++ 3.4.0, 3.4.2, and 2.96 print:
a
~b
~a

... which destroys B without constructing it.


G++ 3.3.2 prints:
a

... which seems correct (A has not finished construction).

-Chris

-- 
           Summary: Global object destroyed that is not constructed
           Product: gcc
           Version: 3.4.2
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: c++
        AssignedTo: unassigned at gcc dot gnu dot org
        ReportedBy: sabre at nondot dot org
                CC: gcc-bugs at gcc dot gnu dot org
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu


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

Reply via email to