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

--- Comment #3 from Jonathan Wakely <redi at gcc dot gnu.org> ---
(In reply to Pablo Anigstein from comment #2)
> (In reply to Andrew Pinski from comment #1)
> > Hmm,
> >  I noticed that since GCC 7 with -std=c++17, the b.x is not initialized at
> > all. So the question I have is there a difference between C++ standards 
> > here?

Derived is an aggregate in C++17, so b{} does aggregate init, not value init.

> > Note the issue is we call Base's constructor after doing the zero
> > initialization and the Base's constructor has a clobber in it which I think
> > is correct.

Maybe we should only clobber in the complete object constructor _ZN4BaseC1Ev
and not in _ZN4BaseC2Ev.

> > This is all front-end generation and not exactly related to the
> > optimizations directly.
> 
> There is no difference between C++ standards in this respect.

Before C++11 there was no zero-init at all. Since C++11 the spec keeps
changing, but the effects of zero-init are substantially the same. But Derived
is an aggregate since C++17.

Aside: What does the comment "not a default constructor" mean in the testcase?

Reply via email to