From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id D29C73858C5E; Fri, 3 Mar 2023 20:51:24 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org D29C73858C5E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1677876684; bh=1JvGPoJXshjYwFmCm+L1gREj6CmEzD/1xxDhqXiWBoc=; h=From:To:Subject:Date:From; b=oA5DdABv1JnRph6UJFwI2Kd9hxJ4EeHA3swhoHczv1xLCp+8FFJVOheG/uoF8SUwE u67MSqxgtzu5DUJzf2yywybwHebxeU3QG1B2u14gNpGP2mNyjjx8j/dM3mcPVvM7G8 o10Qmi42LkL8ATAfwLrzz3/WmigQQ6+tuDCI6F5E= From: "arthur.j.odwyer at gmail dot com" To: gcc-bugs@gcc.gnu.org Subject: [Bug c++/109017] New: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax Date: Fri, 03 Mar 2023 20:51:24 +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: unknown X-Bugzilla-Keywords: ice-on-invalid-code X-Bugzilla-Severity: normal X-Bugzilla-Who: arthur.j.odwyer 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 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=3D109017 Bug ID: 109017 Summary: ICE on unexpanded pack from C++20 explicit-template-parameter lambda syntax Product: gcc Version: unknown Status: UNCONFIRMED Keywords: ice-on-invalid-code Severity: normal Priority: P3 Component: c++ Assignee: unassigned at gcc dot gnu.org Reporter: arthur.j.odwyer at gmail dot com Target Milestone: --- // https://godbolt.org/z/bdT84P318 template struct A { static void g() { int dummy[] =3D { [](Ts... ts){ int i =3D Ts(); } ... }; } }; int main() { A::g(); } : In instantiation of 'static void A< >::g= () [with =3D {int}]': :12:14: required from here :4:13: internal compiler error: in tsubst_pack_expansion, at cp/pt.cc:13388 4 | int dummy[] =3D { | ^~~~~ 0x247a53e internal_error(char const*, ...) ???:0 0xae95dc fancy_abort(char const*, int, char const*) ???:0 0xd09f45 instantiate_decl(tree_node*, bool, bool) ???:0 0xd362db instantiate_pending_templates(int) ???:0 0xbe4555 c_parse_final_cleanups() ???:0 0xe21948 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 Apparently GCC fails to recognize the `class... Ts` in the angle brackets (= new syntax in C++20) as pertaining to the lambda itself, and not to the outer scope. So when GCC sees an unexpanded `Ts` in the inner scope, GCC happily accepts it (and then ICEs). Notice that if you change `Ts()` to `ts` in the inner scope, GCC correctly rejects the code with the usual "parameter packs= not expanded" error. The ICE is triggered specifically by misuse of `Ts`-from-the-new-in-C++20-syntax.=