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: Steven Grady <grady at digitaldeck dot com>
- Subject: Re: g++ 2.95.2 does not provide useful error message when dynamic_cast fails
- From: <llewelly at dbritsch dot dsl dot xmission dot com>
- Date: Tue, 7 Mar 2000 23:16:22 -0700 (MST)
- Cc: "Martin v. Loewis" <martin at loewis dot home dot cs dot tu-berlin dot de>,gcc-bugs at gcc dot gnu dot org
>
> "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.
I would like to point out that Martin Loewis
(1) Responds to bug reports promptly.
(2) Is almost always willing to provide clear explanations of why
something is or is not a bug.
(3) Is almost always polite.
I do not believe Martin intended to insult you.
As a user of gcc, I feel Martin provides a most valuable service, and I
greatly appreciate his work.
>
> > 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
Of course I will always appreciate better error messages, but I wanted
to point out that Martin does an excellent job of responding to bug
reports.