This is the mail archive of the
mailing list for the GCC project.
Re: cannot pass objects of non-POD type
Joe Buck <Joe.Buck@synopsys.COM> writes:
| On Wed, Oct 24, 2007 at 12:15:03PM -0700, Andrew Pinski wrote:
| > On 10/24/07, John Gateley <email@example.com> wrote:
| > > I don't think it is undefined code. The class has no virtual functions,
| > > and the variable argument function doesn't need to know the full size
| > > of the struct, since it is not using it as a String object, it is using
| > > it as a char * pointer (which is what gets passed).
| > Does not matter if the class has no virtual functions or not. The
| > class is a non POD.
| Andrew, I think you're being overly pedantic. While it is true that
| the standard permits what I will call "trivial non-PODs" to be laid
| out differently from PODs, there's another spec we conform to as well,
| the C++ ABI, and that spec specifies in this case that the layout is
| exactly the same as a POD.
| So GCC could support this case and treat the warning as a pedwarn.
I believe there is no question that the code as originally posted
invokes undefined behaviour. C++0x, however, has revised/relaxed the
notion of POD.