This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [C++ PATCH] [PR 13005] Warn about casting of incomplete types
Stephen Ma wrote:
On Fri, Jan 09, 2004 at 08:15:45PM +0000, neil at daikokuya dot co dot uk wrote:
+ /* Make -Wcast-incomplete effective in C++ only */
+ if (c_language != clk_cxx)
+ warn_cast_incomplete = 0;
+
This is unnecessary, given this:
+Wcast-incomplete
+C++
+Warn about casting from/to incomplete types
+
Yes, the test is a bit of defensive programming and is redundant in a
couple of ways. Perhaps I'm too paranoid for my own good; I will
remove it unless somebody objects.
I think it should only warn about casting from/to ptr/ref to
an incomplete type from/to a ptr/ref to another class type. Otherwise there
is no way to silence false positives, and (void *)ptr is ok anyway.
nathan
--
Nathan Sidwell :: http://www.codesourcery.com :: CodeSourcery LLC
nathan@codesourcery.com :: http://www.planetfall.pwp.blueyonder.co.uk