This is the mail archive of the gcc@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: Can our C++ vectors hold derived classes?


On Thu, Jun 13, 2013 at 10:22:01AM +0200, Richard Biener wrote:
> On Thu, Jun 13, 2013 at 10:19 AM, Jakub Jelinek <jakub@redhat.com> wrote:
> > On Thu, Jun 13, 2013 at 10:12:08AM +0200, Richard Biener wrote:
> >> > When I remove the ": public zzzA" part the earnings disappear.  Thus,
> >> > it seems there is an error somewhere... or am I doing something wrong?
> >>
> >> I think you need to avoid using vl_embed vectors because their implementation
> >> uses offsetof.
> >
> > That is all of them though.  vl_ptr uses vl_embed as its vec_ field.
> 
> Oh ... ;)
> 
> So I suppose we need to avoid the use of offsetof.  But of course the whole
> way we construct vec_embedded vectors goes against C++ rules ...
> 
> Thus indeed, we only support POD vector element types (we completely
> lack invocations of constructors and destructors for example).

That is probably because we use vec<something> also in contexts where
you can't use non-POD (e.g. va_arg (ap, vec<...>)).  That is why vec itself
is a POD too.

	Jakub


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