From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id BEAB63950811; Tue, 27 Apr 2021 18:44:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BEAB63950811 From: "davidfromonline at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/100295] New: Internal compiler error from generic lambda capturing parameter pack and expanding it in if constexpr Date: Tue, 27 Apr 2021 18:44:53 +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: 12.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: davidfromonline 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 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: Tue, 27 Apr 2021 18:44:53 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100295 Bug ID: 100295 Summary: Internal compiler error from generic lambda capturing parameter pack and expanding it in if constexpr Product: gcc Version: 12.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: davidfromonline at gmail dot com Target Milestone: --- The following well-formed translation unit ``` template void f(Ts... ts) { auto lambda =3D [=3D](auto x) { if constexpr (sizeof((..., ts), x) !=3D 0) { (..., ts); } }; lambda(0); } void g() { f(0); } ``` causes gcc to crash with ``` : In instantiation of =E2=80=98f(int):: [with = auto:1 =3D int]=E2=80=99: :8:8: required from =E2=80=98void f(Ts ...) [with Ts =3D {int}]= =E2=80=99 :12:3: required from here :5:31: internal compiler error: trying to capture =E2=80=98ts#0=E2= =80=99 in instantiation of generic lambda 5 | (..., ts); | ^~ 0x9c9318 add_capture(tree_node*, tree_node*, tree_node*, bool, bool) ../../source/gcc/cp/lambda.c:637 0x9c9391 add_default_capture(tree_node*, tree_node*, tree_node*) ../../source/gcc/cp/lambda.c:697 0xaa68ef tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) ../../source/gcc/cp/pt.c:20834 0xaa3ea8 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) ../../source/gcc/cp/pt.c:20949 0xaaf3d7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:19204 0xaae9d1 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18229 0xaae9d1 gen_elem_of_pack_expansion_instantiation ../../source/gcc/cp/pt.c:12568 0xaae9d1 tsubst_pack_expansion(tree_node*, tree_node*, int, tree_node*) ../../source/gcc/cp/pt.c:13233 0xaa163f tsubst_fold_expr_pack ../../source/gcc/cp/pt.c:12646 0xaa163f tsubst_unary_left_fold ../../source/gcc/cp/pt.c:12685 0xaa163f tsubst_copy ../../source/gcc/cp/pt.c:17343 0xaa56f2 tsubst_copy_and_build(tree_node*, tree_node*, int, tree_node*, boo= l, bool) ../../source/gcc/cp/pt.c:20962 0xaaf3d7 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:19204 0xab11f9 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18274 0xab0aa3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18595 0xab4503 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18564 0xab0aa3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18595 0xab0aa3 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18595 0xab8308 tsubst_expr(tree_node*, tree_node*, int, tree_node*, bool) ../../source/gcc/cp/pt.c:18229 0xab8308 instantiate_body ../../source/gcc/cp/pt.c:25921 Please submit a full bug report, with preprocessed source if appropriate. Please include the complete backtrace with any bug report. See for instructions. Compiler returned: 1 ```=