This is the mail archive of the gcc-bugs@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re: g++ 2.95.2 does not provide useful error message when dynamic_cast fails


> 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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]