From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id DBE2E3858C2D; Wed, 9 Feb 2022 18:25:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DBE2E3858C2D From: "serpent7776 at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/104470] New: internal compiler error: Segmentation fault compiling std::variant with -std=c++20 Date: Wed, 09 Feb 2022 18:25:02 +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.3.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: serpent7776 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone attachments.created 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 09 Feb 2022 18:25:03 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D104470 Bug ID: 104470 Summary: internal compiler error: Segmentation fault compiling std::variant with -std=3Dc++20 Product: gcc Version: 10.3.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: serpent7776 at gmail dot com Target Milestone: --- Created attachment 52396 --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=3D52396&action=3Dedit Preprocessed source I encountered an internal compiler error while compiling the following code= in c++20 mode (no other flags are needed): #include template struct Foo { T value; }; template struct Bar { T value; }; template using V =3D std::variant, Bar>; int main() { V e =3D Foo("a"); } When I switch to c++17 mode compiler does not crash. I tested it on g++ 10.3.0 on FreeBSD 12.3-RELEASE-p1, but I can also reprod= uce it on trunk version here https://godbolt.org/z/vn5Ws14Ma Full error: # g++10 -std=3Dc++20 ice.ii In file included from ice.cpp:1: /usr/local/lib/gcc10/include/c++/variant: In substitution of 'template template using __accepted_type =3D std::variant<_Types>::__to_type<__accepted_index<_Tp> > [with _Tp =3D _Tp&&; =3D typename std::enable_if, B= ar >::__not_self<_Tp&&>, void>::type; _Types =3D {Foo, Bar}]': ice.cpp:20:15: required from here /usr/local/lib/gcc10/include/c++/variant:1335:36: internal compiler error: Segmentation fault 1335 | using __accepted_type =3D __to_type<__accepted_index<_Tp>>; | ^~~~~~~~~~~~~~~~~~~~ libbacktrace could not find executable to open=