This is the mail archive of the gcc-patches@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]
Other format: [Raw text]

Re: [C++ PATCH] [PR 13005] Warn about casting of incomplete types


On Fri, Jan 09, 2004 at 09:55:38PM -0500, Jason Merrill wrote:
> > This patch is identical to attachment 5429 uploaded to Bugzilla for PR
> > 13005.  I have been asked to post it here, so here it is.
> >
> > It adds a warning about the use of a traditional cast to convert an
> > incomplete type.  The warning happens only in cc1plus, and is on by
> > default.  The patch also adds an option -Wno-cast-incomplete to turn
> > off the warning.
> 
> Please leave it off by default and add it to -Wall.

The warning is currently on by default because it diagnoses a
potential memory corruption problem, which is pretty serious.  I
suggest we leave it on; if it causes too much of an outcry in the
field (unlikely, I think), we can always change it before 3.5 goes
out.


> Most of the text in your patch refers to "casting from/to incomplete
> types", but that isn't actually what you are warning about; you are
> warning about casting to/from *pointers* (or references) to
> incomplete types.  Please clarify this.

The documentation was already long enough.  Since a pointer/reference
to an incomplete type is also an incomplete type, as far as the
predicate COMPLETE_TYPE_P is concerned, I decided to use that meaning
in the documentation too.  I'll see if I can make the words more
precise without turning everything into a completely unreadable lump.

Thanks for looking at the patch.


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