C++ PATCH: typedefs breaking conversions
Nathan Sidwell
nathan@acm.org
Wed Mar 31 08:19:00 GMT 1999
Martin von Loewis wrote:
> > I'm not 100% sure of the legality of Andrew's example, ClassC has
> > base classes -- I thought that made it non-PoD, but can't find words in the
> > standard to that effect (9/4 doesn't mention it).
>
> I'm not sure what you are referring to. I agree that ClassC should be
> non-POD, and I couldn't find the place where it says so in the
> standard either.
found it -- combine 9/4 with 8.5.1/1
> I'm not sure why that would make the case ill-formed. Perhaps you're
> referring to 12.7/1? That might make it undefined behaviour. However,
> it is undefined behaviour, anyway, as it derefences a null pointer. It
> should still be well-formed.
Sorry, I meant illegal as in `invokes undefined behaviour'. I believe we should
emit a warning whenever we can detect undefined behaviour that we've not
otherwise defined as an extension (1.3.12 allows us to do this). Andrew's code
looked like an application of the offsetof macro. That has to work for pod
struct, but when applied to non-pod, it invokes undefined behaviour (18.1/5).
Along these lines, I'm attacking the non-PoD problem -- to emit a warning in
appropriate places. It appears the gcc.2.8.x `cannot pass non-pod in `...''
warning code has attrophied too ... I'll fix that too.
nathan
--
Dr Nathan Sidwell :: Computer Science Department :: Bristol University
You can up the bandwidth, but you can't up the speed of light
nathan@acm.org http://www.cs.bris.ac.uk/~nathan/ nathan@cs.bris.ac.uk
More information about the Gcc-patches
mailing list