This is the mail archive of the gcc-bugs@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]

[Bug c++/42121] g++ should warn or error on internal 0 size array in struct



------- Comment #7 from redi at gcc dot gnu dot org  2009-11-23 14:53 -------
(In reply to comment #6)
> 
> OK, can't argue with not breaking existing headers I suppose.  But this is to
> me clearly a bogus usage.  What are the semantics of using internal zero sized
> arrays in a struct?  They have the same offset as the following field and
> impose alignment restrictions on it.  Do they have the same nominal
> requirements as unions for usage (can't write one, read the other?)?  Or is the
> idea that if they are 0 sized and internal they are not to be used for any
> purpose whatsoever, and they are only not warnable because of existing usage in
> glibc headers?

All good questions!

It should be possible to make the C++ front end stricter about these so that
outside of system headers they are an error, downgradeable to a warning with
-fpermissive. I might try that.


-- 


http://gcc.gnu.org/bugzilla/show_bug.cgi?id=42121


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