From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id C73E03858C98; Tue, 26 Dec 2023 01:36:14 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org C73E03858C98 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1703554574; bh=bugCcT3hU1phFdBdS9YXYkP0cdJ0VIRYM4MIJOFy1Qw=; h=From:To:Subject:Date:From; b=tz+M1DmxTn8jUs3waL+xI+Jat6SEFacQOnuFcPnKBIV+gDlD0GzAlJZwo31rYXJId jj4AFx9TOk7vIoDbG7yteQq93qPq/Dkz6p+xN6+yg+a2JtbSpUj/s0PapHB7V7jB70 EAuIXZwLoex9KlFqyPdBgCJWB/aYnpfe69J25Oco= From: "de34 at live dot cn" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/113141] New: ICE on conversion to reference in aggregate initialization Date: Tue, 26 Dec 2023 01:36:13 +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: 13.2.1 X-Bugzilla-Keywords: ice-checking, ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: de34 at live dot cn 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 keywords 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=3D113141 Bug ID: 113141 Summary: ICE on conversion to reference in aggregate initialization Product: gcc Version: 13.2.1 Status: UNCONFIRMED Keywords: ice-checking, ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: de34 at live dot cn Target Milestone: --- The following program triggers ICE since GCC 13 (https://godbolt.org/z/PaqWsG9s6): ``` int global_x{}; struct ConvToRef { operator int&() { return global_x; } }; struct Foo { int& r; }; int main() { Foo bar{ { ConvToRef{} } }; } ``` Clang considers this ill-formed and emits "non-const lvalue reference to ty= pe 'int' cannot bind to an initializer list temporary". If the type of r is changed to const int&, the program correctly compiles w= ith GCC.=