This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
[Bug c++/32525] Request for new warning: useless dynamic_casts
- From: "pinskia at gcc dot gnu dot org" <gcc-bugzilla at gcc dot gnu dot org>
- To: gcc-bugs at gcc dot gnu dot org
- Date: 27 Jun 2007 18:14:03 -0000
- Subject: [Bug c++/32525] Request for new warning: useless dynamic_casts
- References: <bug-32525-6477@http.gcc.gnu.org/bugzilla/>
- Reply-to: gcc-bugzilla at gcc dot gnu dot org
------- Comment #1 from pinskia at gcc dot gnu dot org 2007-06-27 18:14 -------
> However it would be nice if the programmer was notified about them,
> since even if there is no run-time cost, there is a source-level increase in
> complexity which can easily be avoided (and there may well be run-time costs
> involved with other compilers).
If this warning comes into GCC, we should disable it for templates. The main
reason why I say that is because if you do:
template<typename A, typename B>
A* f(B *b)
{
return dynamic_cast<A*>(b);
}
And then instanitite it where typename A == typename B, it is hard to avoid the
warning in this case.
--
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=32525