This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

egcs and exception declaration


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]