[Bug c++/32525] Request for new warning: useless dynamic_casts
pinskia at gcc dot gnu dot org
gcc-bugzilla@gcc.gnu.org
Wed Jun 27 18:14:00 GMT 2007
------- 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
More information about the Gcc-bugs
mailing list