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




"Martin v. Loewis" wrote:

> > 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++.

The bug is that the compiler is producing a poor message. Admittedly,
it is not an error in code production, but quality software handles error
conditions as gracefully as it handles correct input. Would you use a
compiler
that produced the single message "User Error" on all syntactic and
semantic
errors?

Do you still fail to see the bug? If so, perhaps the job of handling bugs
should be given with a less narrow view of what is involved in quality
software.

It is not the bug-reporter's job to teach the bug-receiver proper software

quality techniques. It is not the bug-receiver's job to insult the
bug-reporter.

> 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.

Done.

    Steven



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