This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: middle-end/8405: GCC 3.2: 'throw "exception";' not caught by catch
- From: bangerth at dealii dot org
- To: dobrynin at cs dot uwm dot edu, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org
- Date: 30 Oct 2002 20:55:52 -0000
- Subject: Re: middle-end/8405: GCC 3.2: 'throw "exception";' not caught by catch
- Reply-to: bangerth at dealii dot org, dobrynin at cs dot uwm dot edu, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, nobody at gcc dot gnu dot org, gcc-gnats at gcc dot gnu dot org
Synopsis: GCC 3.2: 'throw "exception";' not caught by catch
State-Changed-From-To: open->closed
State-Changed-By: bangerth
State-Changed-When: Wed Oct 30 12:55:51 2002
State-Changed-Why:
Not a bug. An exception specification attached to a function
does not imply any conversion of the exception actually thrown.
You have to throw std::string("something").
The program aborts since the exception actually thrown
does not match the exception specification of the function.
I don't know it right off my head what happens exactly in
this case (look it up in any book on C++), but this leads
either to raising a special exception or calling
uncaught_exception or some such function. In any case,
the catch(...) clause is not invoked in this case.
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=8405