From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B26FE3884597; Sat, 1 Jun 2024 12:54:57 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B26FE3884597 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1717246497; bh=JWE5s9RYN3RqKL21n+tM4r9nbHm3U0low/KYnT8Q4vA=; h=From:To:Subject:Date:From; b=BYQS3gcj9+RMX+YimZr5y5LYXEzqqSOnRWhhNa1xZSm3v0WIaB1njbpum0fVcFrof CITfRsPSFiO1flLLLPSwmvNvLq8CKqfQ4ldBH/lfgRgIuQEb8DmA16nvTfb5FP71G2 DUnuardUq5q/XOfRdXnBm8UTaRJT3MnBmFcr3wNg= From: "blubban at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/115318] New: decltype(lambda) with some templates causes ICE Date: Sat, 01 Jun 2024 12:54:57 +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: 14.1.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: blubban 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 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115318 Bug ID: 115318 Summary: decltype(lambda) with some templates causes ICE Product: gcc Version: 14.1.0 Status: UNCONFIRMED Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: blubban at gmail dot com Target Milestone: --- template struct S {}; template void foo() { using foo_t =3D decltype([](){}); []() { S{}; }(); } void bar() { foo(); } -std=3Dc++20 : In instantiation of 'foo<>():: [with int k =3D 6]': :7:36: required from 'void foo() [with int i =3D 4]' 7 | []() { S{}; }(); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~ :10:17: required from here 10 | void bar() { foo(); } | ~~~^~ :6:28: internal compiler error: in tsubst, at cp/pt.cc:16401 6 | using foo_t =3D decltype([](){}); | ^~~~~~ 0x202ef4c internal_error(char const*, ...) ???:0 0x778915 fancy_abort(char const*, int, char const*) ???:0 0x938dd0 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x943a11 tsubst_lambda_expr(tree_node*, tree_node*, int, tree_node*) ???:0 0x939200 tsubst(tree_node*, tree_node*, int, tree_node*) ???:0 0x93c437 tsubst_template_args(tree_node*, tree_node*, int, tree_node*) ???:0 0x931a0f instantiate_decl(tree_node*, bool, bool) ???:0 0x831fb7 maybe_instantiate_decl(tree_node*) ???:0 0x8332f7 mark_used(tree_node*, int) ???:0 0x7a20a3 build_op_call(tree_node*, vec**, int) ???:0 0x9602fe finish_call_expr(tree_node*, vec**, b= ool, bool, int) ???:0 0x931a0f instantiate_decl(tree_node*, bool, bool) ???:0 0x94d2e3 instantiate_pending_templates(int) ???:0 0x835608 c_parse_final_cleanups() ???:0 0xa0c508 c_common_parse_file() ???:0 Please submit a full bug report, with preprocessed source (by using -freport-bug). Please include the complete backtrace with any bug report. See for instructions. Compiler returned: 1 If you make the first lambda a template ( decltype([](){}) ), you'll g= et a internal compiler error: Segmentation fault instead. Probably the same root cause. Online reproducer: https://godbolt.org/z/EfxPxKWhd I tried searching for duplicates, but every open issue I could find in bug #107430 is a mess, I can't determine if it's the same.=