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

--- Comment #7 from Arvid Jonasson <jonassonarvid02 at gmail dot com> ---
(In reply to Jonathan Wakely from comment #1)
> 
> C does not have a user-provided default constructor, so value-initialization
> means:
> 
> "- the object is zero-initialized and the semantic constraints for
> default-initialization are checked, and if T has a non-trivial default
> constructor, the object is default-initialized;"
> 

>From my understanding, since C is an aggregate type, it should be initialized
using aggregate initialization as outlined in [dcl.init.list]
(https://eel.is/c++draft/dcl.init#list-3.4). This process should construct the
b member without first zero-initializing it, as specified in [dcl.init.aggr]
(https://eel.is/c++draft/dcl.init#aggr-5.2), [dcl.init.list]
(https://eel.is/c++draft/dcl.init#list-3.5) and [dcl.init.general]
(https://eel.is/c++draft/dcl.init#general-9.1).

Given this, it seems that the inclusion of the memset instruction might be
unnecessary. Could someone confirm whether this interpretation is correct? If
so, it might be worth revisiting and potentially reopening the issue.

Reply via email to