[Bug c++/12054] New: Improper handling of exception throw while constructing exception

sabre at nondot dot org gcc-bugzilla@gcc.gnu.org
Mon Aug 25 14:52:00 GMT 2003


PLEASE REPLY TO gcc-bugzilla@gcc.gnu.org ONLY, *NOT* gcc-bugs@gcc.gnu.org.

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

           Summary: Improper handling of exception throw while constructing
                    exception
           Product: gcc
           Version: 3.4
            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 build triplet: i686-pc-linux-gnu
  GCC host triplet: i686-pc-linux-gnu
GCC target triplet: i686-pc-linux-gnu

According to http://www.codesourcery.com/cxx-abi/abi-eh.html#cxx-throw,
this program should print success, but instead it calls terminate.

#include <stdio.h>

struct foo {
  foo() {}
  foo(const foo &F) { throw 1; }
};

int main() {
        try {
                foo f;
                throw f;
        } catch (int i) {
                printf("Success!\n");
                return 0;
        }
}



More information about the Gcc-bugs mailing list