This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
egcs and exception declaration
- To: egcs-bugs at egcs dot cygnus dot com
- Subject: egcs and exception declaration
- From: Rüdiger Schmitz <ruediger dot schmitz at a1-net dot de>
- Date: Wed, 02 Jun 1999 14:44:26 +0200
Hello egcs-team,
I'm trying to use the C++ feature of declaring the possible Exceptions
of a function in its signature. Following is a demonstration:
------ cut ------
//Header file x.hh:
class X1 {
};
class X2 {
};
void foo() throw (X1, X2);
------- cut -------
// implementation x.cc
#include "x.hh"
void foo() throw (X1, X2) { // <- egcs complains!
}
int main() {
foo();
return 0;
}
------- cut --------
This should be valid C++ code, but the compiler complains like this:
> g++ x.cc
x.cc: In function `void foo()':
x.cc:4: warning: declaration of `foo()' throws different exceptions
x.hh:8: warning: previous declaration here
But if I rewrite the implementation of "foo" like this:
void foo() throw (X2) {...}; // X1 omitted!!
the code compiles ok. Am I missing something, or is it really a bug?
The version of the used egcs is: gcc version egcs-2.90.29 980515
(egcs-1.0.3 release)
Ruediger Schmitz