https://gcc.gnu.org/bugzilla/show_bug.cgi?id=108993
panigstein at hotmail dot com changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |panigstein at hotmail dot com --- Comment #2 from panigstein at hotmail dot com --- (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? > > 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. > > This is all front-end generation and not exactly related to the > optimizations directly. There is no difference between C++ standards in this respect. For a class that has a defaulted default constructor (Derived), value-initialization consists of zero-initialization followed by default-initialization. The clobbering of the Base sub-object is incorrect here and makes the implementation of value-initialization non-conforming.