This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: Bug#228099: g++-3.3: exception in constructor of a class to be thrown is not caught
- From: Matthias Klose <doko at cs dot tu-berlin dot de>
- To: Alexander Motzkau <a dot motzkau at web dot de>, 228099 at bugs dot debian dot org
- Cc: gcc-help at gcc dot gnu dot org
- Date: Sun, 25 Jan 2004 17:48:51 +0100
- Subject: Re: Bug#228099: g++-3.3: exception in constructor of a class to be thrown is not caught
- References: <E1AhWRl-0002X5-00@laptop.motzkau>
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