[C++-sig] Exceptions with pybindgen and gccxmlparser

James Vogel jvogel at vtiinstruments.com
Thu Feb 11 19:16:22 CET 2010


Hello --

Trying to use pybindgen.gccxmlparser, and running into an issue with exception handling.

I have a virtual class that declares
virtual int throw_error() throw (std::exception);
and a non-virtual class that extends the virtual class and overrides throw_an_error to throw an actual error. I run the module parser and generate foo.cpp. When I build foo.cpp, it has a build error:
"looser throw specifier for 'virtual int PyNon_virtual_class__PythonHelper::throw_error()' overriding 'virtual int non_virtual_class::throw_error() throw (std::exception)"

If I remove the function declaration from the virtual class (so that the implementation is not overriding an inherited method), it works correctly. Similarly, if I go into foo.cpp and manually add 'throw (std::exception)' to the relevant declarations, it works, so I suspect there's something afoot in the gccxml parsing that isn't picking up the throw clause in the virtual class; I'm just not sure if there's an annotation I might be missing, or some other issue.

Anyone seen this before?

James.


More information about the Cplusplus-sig mailing list