When compiling with -O3 everything is fine. When compiling with -g this pointer passed to constructors and destructors don't line up. I guess the this pointer passed to the constructor is bogus.
-- Summary: wrong this pointer passed to constructor of temporary object Product: gcc Version: 4.2.2 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ AssignedTo: unassigned at gcc dot gnu dot org ReportedBy: peter_foelsche at agilent dot com http://gcc.gnu.org/bugzilla/show_bug.cgi?id=34121