Red Hat Bugzilla – Bug 32119
g++ does not check exception-specifications
Last modified: 2007-04-18 12:32:14 EDT
From Bugzilla Helper:
User-Agent: Mozilla/4.76 [en] (X11; U; Linux 2.2.16-22smp i686)
When a function specifies the exceptions that it may throw, the compiler
can check if a caller is either handling the exceptions or throwing them
too. g++ does not check that.
Steps to Reproduce:
void foo() throw (exception)
foo(); // should get a warning here
Actual Results: The program above compiles without any warning and
dumps core when run.
Expected Results: The program should still compile, but g++ should give a
warning that the exception is not being handled, so the programmer could
create a try block and handle it more gracefully than simply dumping core.
void foo() throw(int)
should also generate a warning.
This is an enhancement request that should have been filed upstream.