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

--- Comment #5 from janus at gcc dot gnu.org ---
(In reply to Tobias Burnus from comment #1)
> b) For bar's "x" there is no warning as it is sym->attr.referenced, but I
> think one should warn that the "declared type" does not have an initializer.

With 4.9 trunk, the following code is generated for 'bar':


bar (struct __class_MAIN___T2 & restrict x)
{
  if (x->_vptr->_final != 0B)
    {
      {
        struct array0_unknown desc.0;

        desc.0.dtype = 600;
        desc.0.data = (void * restrict) x->_data;
        x->_vptr->_final (&desc.0, x->_vptr->_size, 0);
      }
    }
  (void) __builtin_memcpy ((void *) x->_data, (void *) x->_vptr->_def_init,
(unsigned long) x->_vptr->_size);
}


The _final call is new in 4.9, but the memcpy from _def_init appeared already
with 4.7 and 4.8. (Possibly this is what sets sym->referenced?)


However, I'm not convinced that one should throw a warning here: Even if the
declared type does not have a default initializer, an extended type might have
one and of course we don't know the actual (dynamic) type of the class variable
at compile time (that's why we have the _def_init after all).

Reply via email to