[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#228099: g++-3.3: exception in constructor of a class to be thrown is not caught



Alexander Motzkau writes:
> Package: g++-3.3
> Version: 1:3.3.2-4
> Severity: normal
> 
> Hi there,
> 
> Running the following code compiled with 'g++-3.3 testex.cc'
> results in a SIGABRT. I see no reason why this should happen.
> With g++ 3.2 it works, i.e. the exception 1 in A() is caught
> by the try-block.
> 
> 
> # 1 "testex.cc"
> # 1 "<built-in>"
> # 1 "<command line>"
> # 1 "testex.cc"
> class A
> {
>     public:
>         A() {throw(1);}
> };
> 
> int main(int argc, char *argv)
> {
>     try
>     {
>         throw A();
>     }
>     catch(...)
>     {
>     }
> }

is this actually a bug?

gcc-3.4 (CVS 20040113) and 3.5 (CVS 20040113 tree-ssa) are more verbose:

$ /usr/lib/gcc-snapshot/bin/g++ bug-228099.cc && LD_LIBRARY_PATH=/usr/lib/gcc-snapshot/lib ./a.out 
terminate called after throwing an instance of 'i'
Aborted

$ /usr/lib/gcc-experimental/bin/g++ bug-228099.cc && LD_LIBRARY_PATH=/usr/lib/gcc-experimental/lib ./a.out 
terminate called without an active exception
Aborted



Reply to: