This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: g++ 2.95.2 does not provide useful error message when dynamic_cast fails
- To: grady at digitaldeck dot com
- Subject: Re: g++ 2.95.2 does not provide useful error message when dynamic_cast fails
- From: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>
- Date: Tue, 7 Mar 2000 23:32:01 +0100
- CC: gcc-bugs at gcc dot gnu dot org
- References: <38C57497.79EE1E6B@digitaldeck.com>
> According to the code (cp/rtti.c: build_dynamic_cast_1), almost all
> errors result in
> the same message:
> cannot dynamic_cast `%E' (of type `%#T') to type `%#T
> This message is not particularly explanatory. In particular, it took
> me a couple of hours to figure out that a dynamic cast was failing
> because the type of the expr being cast did not have a vtbl. (I
> figured out the problem only by looking at the above gcc source
> code.)
Thanks for your bug report; I fail to see the bug, though. It is not
the compiler's job to teach the user C++.
Of course, if you can suggest specific patches to improve the quality
of the g++ diagnostics, they would be much appreciated. Please send
them to gcc-patches@gcc.gnu.org.
Regards,
Martin