From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 702283870C32; Thu, 23 Nov 2023 16:34:26 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 702283870C32 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1700757266; bh=HgNT/XoGwcs2VoztYDfAAUTtu5gmgtef9L8TiCdA3/8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=cbm0hJ+b5lk6CVGjhWmO2unESrGCBLgBY901MUhcI05+BSBM0djGEyItx9Nt5Zpry /Yv9f3RaB/2qVfMD0MH0oPJku3EvJgNJUHu3J1SCsyQOGeDb5G/hxrtQln6xnZtEQ+ eRhSOjENcOjJBa1OdpVv0qimZhrUhSc8El67YU14= From: "redi at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/112666] Missed optimization: Value initialization zero-initializes members with user-defined constructor Date: Thu, 23 Nov 2023 16:34:25 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 11.4.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: redi at gcc dot gnu.org X-Bugzilla-Status: RESOLVED X-Bugzilla-Resolution: FIXED X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D112666 --- Comment #5 from Jonathan Wakely --- (In reply to Francisco Paisana from comment #4) > One last thing, I might have misread this as well.=20 >=20 > > "Zero-initialization is performed in the following situations: > > ... > > 2) As part of value-initialization sequence [...] for members of > > value-initialized class types that have no constructors." >=20 > I was interpreting it as "members that have no ctors of classes are > zero-init". I don't even know what that would mean. > However, this could be also read as "members of classes, where > the classes have no ctor, are zero-init." This is the correct reading. N.B. cppreference is not the standard. It's usually an accurate paraphrasin= g of the standard, but it's not gospel.=