Why does debugging "pure virtual method called" have to be so hard?
Joe Buck
jbuck@synopsys.com
Mon Oct 26 13:42:00 GMT 1998
> Calling a pure virtual function is not a case of exception handling,
> so it might be strange to call it in such a situation.
This is too bad. I wish the committee had specified that an exception
be thrown here; it would be consistent with the rest of the language.
Everywhere else, if the user does something illegal that can't be caught
at compile time (e.g. bad dynamic cast of a reference), we throw an exception.
> ... calling a pure virtual function has undefined behavior ...
which means we can do what we want.
I vote for
throw __pure_virtual_exception;
where that class is derived from class std::exception.
More information about the Gcc
mailing list