From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D5A503858D38; Fri, 22 Mar 2024 07:52:40 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D5A503858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1711093960; bh=an0PJeScmLX6+odDFTehRZV3/3GOylVKV2Rznq7/wps=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qeutJf8ZcnJWW8jMyTRCCbqymgglFoMkdL84Nkx3V68gV7XUZQwCCvEWsnR2db7fE yOtpkOd5cV2IDm45ksNo9bIKaPuDjAGFmtpjXX7ij1vVCvF33EqUj2QlwoAj230ShG Izu+2UxaDez66BRHmotpgjrQ2s4t7Tx6eGzMQnRU= From: "fchelnokov at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104282] Copy elision when initializing a base-class subobject with aggregate initialization Date: Fri, 22 Mar 2024 07:52:39 +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: 12.0 X-Bugzilla-Keywords: ABI, wrong-code X-Bugzilla-Severity: normal X-Bugzilla-Who: fchelnokov at gmail dot com X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: 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=3D104282 --- Comment #8 from Fedor Chelnokov --- One more inconsistency here: struct A { A() {}=20 A(A&&) =3D delete; }; struct B : A { }; int main() { // ok in GCC B{ A{} }; // error in GCC B b{ A{} }; } GCC allows temporary creation B{ A{} }, but prohibits variable creation B b{ A{} }. Online demo: https://gcc.godbolt.org/z/YGjYYqo6M It looks like both must be prohibited as in Clang (or both allowed as in MS= VC). Related discussion: https://stackoverflow.com/q/70898525/7325599=