This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Why does debugging "pure virtual method called" have to be so hard?
- To: oliva at dcc dot unicamp dot br (Alexandre Oliva)
- Subject: Re: Why does debugging "pure virtual method called" have to be so hard?
- From: Joe Buck <jbuck at synopsys dot com>
- Date: Mon, 26 Oct 98 12:17:17 PST
- Cc: jason at cygnus dot com, mrs at wrs dot com, egcs at cygnus dot com
> 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.