https://gcc.gnu.org/bugzilla/show_bug.cgi?id=91353

--- Comment #5 from Marek Polacek <mpolacek at gcc dot gnu.org> ---
(In reply to Marek Polacek from comment #4)
> (In reply to Jakub Jelinek from comment #3)
> > (In reply to Marek Polacek from comment #2)
> > > The quux case: CONSTRUCTOR_NO_CLEARING is cleared here
> > > 
> > > 2154   /* The result of a constexpr function must be completely 
> > > initialized.
> > > */
> > > 2155   if (TREE_CODE (result) == CONSTRUCTOR)
> > > 2156     clear_no_implicit_zero (result);
> > > 
> > > but we can no longer assume that a constexpr constructor has initialized 
> > > all
> > > the members.
> > 
> > I'd think we can still assume it for non-constructors (because if a function
> > returns some aggregate, it went through the lvalue to rvalue conversion and
> > therefore shouldn't refer to uninitialized members).  Constructors don't
> > really
> > return the object they are initializing.  Though, perhaps we should make a
> > difference between constructors that do have member initializers for all
> > members and those that don't.
> 
> I'm experimenting with the last -- add an allow_missing param to
> cx_check_missing_mem_inits and don't clear the flag when there are inits
> missing.

... unless the initializer is { } in which case we're performing aggregate-init
or value-init so the flag ought to be cleared.

Reply via email to