This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
unhandled exception if empty exception specification
- To: <egcs-bugs at egcs dot cygnus dot com>
- Subject: unhandled exception if empty exception specification
- From: "Jesse Rothstein" <jesse at motive dot com>
- Date: Wed, 10 Mar 1999 09:21:04 -0600
Greetings,
First, I appologize in advance if this is a known bug, though I did check
the list of well-known bugs first. I also appologize if due to some lack of
understanding on my part, this is the desired behavior. In any case, an
empty exception specification seems to cause an unhandled exception as the
following code illustrates with a most graceful segfault:
void bar() throw() {
throw "bar";
}
int main()
{
try {
bar();
}
catch (const char *p) {
cerr << "got exception: " << p << endl;
}
catch (...) {
cerr << "got generic exception" << endl;
}
}
Now, if I fill in the exception specification, everything works as expected:
void bar() throw(const char *) {
throw "bar";
}
I tried this on both a Linux box running the default RedHat 5.2 installation
and an Ultra Sparc running Solaris:
bash-2.00$ uname -a
SunOS warpspeed 5.7 Generic sun4u sparc SUNW,Ultra-5_10
bash-2.00$ g++ -v
Reading specs from
/opt/local/lib/gcc-lib/sparc-sun-solaris2.6/egcs-2.91.60/specs
gcc version egcs-2.91.60 19981201 (egcs-1.1.1 release)
Later...
--Jesse