[C++-sig] Bug: Pyste and pure virtual functions.
Nicodemus
nicodemus at globalite.com.br
Sat Aug 16 00:25:02 CEST 2003
Hi Prabhu!
Prabhu Ramachandran wrote:
>hi,
><snip>
> unsigned int default_f() {
> PyErr_SetString(PyExc_RuntimeError, "pure virtual function called");
> throw_error_already_set();
> return unsigned int();
> }
>
>Which generates a parse error. Additionally returning some_class()
>also requires that the class have a nullary constructor which might
>not always be available. I find that generating this code instead
>works fine under gcc 2.95.4:
>
> unsigned int default_f() {
> PyErr_SetString(PyExc_RuntimeError, "pure virtual function called");
> throw error_already_set();
> }
>
>This compiles cleanly (with no warnings) for me but is it valid C++
>and will it work properly under all compilers? If this is OK I'll
>send in a patch to fix this. If not, are there other ways to handle
>this correctly?
>
Hi Prabhu!
My first version was like yours, but the missing return generates
warnings with Intel 6, so I added it. I didn't know it would generate an
error in gcc, thought 8/
Any suggestions?
Regards,
Nicodemus.
More information about the Cplusplus-sig
mailing list