Package: g++-4.2
Version: 4.2.1-6
Severity: normal

  g++ seems to ignore exception handlers in unpredictable ways.  I've
attached a minimal program that illustrates what's been happening to me.
It aborts with an uncaught exception ("terminate called after throwing
an instance of 'exception'").  But if you comment out either the line
instantiating a class that crashes in its destructor, or the line that
explicitly throws an exception, the exception is caught as expected.

  Daniel

-- System Information:
Debian Release: lenny/sid
  APT prefers unstable
  APT policy: (500, 'unstable')
Architecture: i386 (i686)

Kernel: Linux 2.6.22-2-686 (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages g++-4.2 depends on:
ii  gcc-4.2                       4.2.1-6    The GNU C compiler
ii  gcc-4.2-base                  4.2.1-6    The GNU Compiler Collection (base 
ii  libc6                         2.6.1-5    GNU C Library: Shared libraries
ii  libstdc++6-4.2-dev            4.2.1-6    The GNU Standard C++ Library v3 (d

g++-4.2 recommends no packages.

-- no debconf information
#include <iostream>

class exception
{
};

class crash_in_destructor
{
public:
  ~crash_in_destructor()
  {
    exception tmp;
    throw tmp;
  }
};

int main(int argc, char **argv)
{
  try
    {
      crash_in_destructor tmp;
      exception tmp2;
      throw tmp2;
    }
  catch(exception)
    {
      std::cout << "PASS" << std::endl;
      return 0;
    }

  std::cout << "FAIL" << std::endl;
  return -1;
}

Reply via email to