From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 63BB83858C50; Tue, 25 Oct 2022 17:44:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 63BB83858C50 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1666719841; bh=ECmQKln1wWINaHtDY/BzTz4zkcOIemcb8NV8wXo01TU=; h=From:To:Subject:Date:From; b=syUXrpPKlcbI4RASDXNmEM1sczswg6IYZMfaSGBwAiXaU5AOUeb2/w+DANtFnsllb ykpyyBJxIHpz0AlV+SNc/rjtKrS/lZUhDIl8FdphpYFEXwmykwR7N600iAPJvfhWaw gqeoy3r3uQkZkB9lcRqJ8rz7NcZY4iTChC/fsvU0= From: "ayzhao at google dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/107402] New: Parenthesized aggregate initialization should not initialize references Date: Tue, 25 Oct 2022 17:44:00 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: c++ X-Bugzilla-Version: 10.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: ayzhao at google 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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=3D107402 Bug ID: 107402 Summary: Parenthesized aggregate initialization should not initialize references Product: gcc Version: 10.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: ayzhao at google dot com Target Milestone: --- The implementation of P0960R3 in and allowed f= or initialization of references by creating and initializing a temporary of the referered type. Therefore, statements such as const MyStruct& m(1, 1); int (&&rr)[](1, 2, 3, 4);=20 are accepted by GCC: A close reading of the C++ standard suggests that these expressions are not allowed. Reference initialization via a temporary is described in , and that only permits conversion= by constructor or conversion function (if the source or destination is of class type) or implicit conversion, not arbitrary direct-initialization conversio= ns (which would include aggregate initialization)=