get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/1.1/patches/2223580/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 2223580,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2223580/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260415161149.691849-1-polacek@redhat.com/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/1.1/projects/17/?format=api",
        "name": "GNU Compiler Collection",
        "link_name": "gcc",
        "list_id": "gcc-patches.gcc.gnu.org",
        "list_email": "gcc-patches@gcc.gnu.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null
    },
    "msgid": "<20260415161149.691849-1-polacek@redhat.com>",
    "date": "2026-04-15T16:11:49",
    "name": "c++/reflection: generic lambda with dependent splice [PR123783]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "dee8db103cd0bcc9c0da555e9497cb8468fb56f6",
    "submitter": {
        "id": 14370,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/14370/?format=api",
        "name": "Marek Polacek",
        "email": "polacek@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260415161149.691849-1-polacek@redhat.com/mbox/",
    "series": [
        {
            "id": 500013,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/500013/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500013",
            "date": "2026-04-15T16:11:49",
            "name": "c++/reflection: generic lambda with dependent splice [PR123783]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500013/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2223580/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2223580/checks/",
    "tags": {},
    "headers": {
        "Return-Path": "<gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@legolas.ozlabs.org",
            "gcc-patches@gcc.gnu.org"
        ],
        "Authentication-Results": [
            "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=cVB60pxF;\n\tdkim-atps=neutral",
            "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=2620:52:6:3111::32; helo=vm01.sourceware.org;\n envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org;\n receiver=patchwork.ozlabs.org)",
            "sourceware.org;\n\tdkim=pass (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=cVB60pxF",
            "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=redhat.com",
            "sourceware.org; spf=pass smtp.mailfrom=redhat.com",
            "server2.sourceware.org;\n arc=none smtp.remote-ip=170.10.133.124"
        ],
        "Received": [
            "from vm01.sourceware.org (vm01.sourceware.org\n [IPv6:2620:52:6:3111::32])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fwmPp44bsz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 02:12:28 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 985E54BA2E0E\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 16:12:26 +0000 (GMT)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.133.124])\n by sourceware.org (Postfix) with ESMTP id D3FB94BA2E07\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 16:11:56 +0000 (GMT)",
            "from mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-482-QDzy_mvuMRy_aF6clEa3Lg-1; Wed,\n 15 Apr 2026 12:11:54 -0400",
            "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id BA60D19560B2\n for <gcc-patches@gcc.gnu.org>; Wed, 15 Apr 2026 16:11:53 +0000 (UTC)",
            "from pdp-11.redhat.com (unknown [10.22.81.27])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 2B7D619560B1; Wed, 15 Apr 2026 16:11:52 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 985E54BA2E0E",
            "OpenDKIM Filter v2.11.0 sourceware.org D3FB94BA2E07"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org D3FB94BA2E07",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org D3FB94BA2E07",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776269516; cv=none;\n b=qPrmi6Gcira7/RMy+nsGl2BnGRD5wZKow3NrzS/PcGJzig5Gb0vuNhl9ac9CSjmFWCzQ+J4HcoN+JOOcn/evxZdqTtMKRtOdFMobl/t8OzjQi8yIESL9B+mJY7gje4kGNT6sRI1DUEnxttYSaZeDRYwdaQYw+2JIStJAWMKIrzg=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776269516; c=relaxed/simple;\n bh=8KpU+OdnZdryFOXiwGo5HflknixIdD3wrjJ8Hh7FXXY=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=OO/f9oKjfPwC6ckQwgdn8GDMNcrkN5aYHDw64gwfAXkuCJvzQk11akAKfGxDozPMchepPpXycHPmTDq0XlVPuCZMpN+Ujug7kVjcH/3T6dgusgsMzvYVjjn3JtVuYJofpkPwIA/L4G8D3FlEjrEQIHX38l4nliZcEa8+jN/0rDo=",
        "ARC-Authentication-Results": "i=1; server2.sourceware.org",
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1776269516;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:mime-version:mime-version:content-type:content-type:\n content-transfer-encoding:content-transfer-encoding;\n bh=2JTE3lz+BcNlkE3dQSFOtVtFkFBq/P5OfY6jUz/eQds=;\n b=cVB60pxFIeiueWAuL4zFc8kj9APP4YAR9k+nwHOGBicKtJFeubn7smwqcdlnD5n9oD9eHG\n zyaHIOB8UIAuag4E0FxaHKYJTN4pkAXo6wX9mWXvjsn/5mvEEkv6LvVaavsa4jIZ2KO81h\n 17BYUVzoO0NMIl8dAbzR+Ap6XIv/6Qg=",
        "X-MC-Unique": "QDzy_mvuMRy_aF6clEa3Lg-1",
        "X-Mimecast-MFC-AGG-ID": "QDzy_mvuMRy_aF6clEa3Lg_1776269514",
        "From": "Marek Polacek <polacek@redhat.com>",
        "To": "GCC Patches <gcc-patches@gcc.gnu.org>,\n\tJason Merrill <jason@redhat.com>",
        "Subject": "[PATCH] c++/reflection: generic lambda with dependent splice\n [PR123783]",
        "Date": "Wed, 15 Apr 2026 12:11:49 -0400",
        "Message-ID": "<20260415161149.691849-1-polacek@redhat.com>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "mqO30_APRH7t2ONDnQKtFy9Azv-JplA_asbxcYbpEko_1776269514",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Transfer-Encoding": "8bit",
        "content-type": "text/plain; charset=\"US-ASCII\"; x-default=true",
        "X-BeenThere": "gcc-patches@gcc.gnu.org",
        "X-Mailman-Version": "2.1.30",
        "Precedence": "list",
        "List-Id": "Gcc-patches mailing list <gcc-patches.gcc.gnu.org>",
        "List-Unsubscribe": "<https://gcc.gnu.org/mailman/options/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe>",
        "List-Archive": "<https://gcc.gnu.org/pipermail/gcc-patches/>",
        "List-Post": "<mailto:gcc-patches@gcc.gnu.org>",
        "List-Help": "<mailto:gcc-patches-request@gcc.gnu.org?subject=help>",
        "List-Subscribe": "<https://gcc.gnu.org/mailman/listinfo/gcc-patches>,\n <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?\n\n-- >8 --\nFor a generic lambda, we normally collect the captures while parsing\nthe lambda: finish_id_expression calls process_outer_var_ref which does\nadd_capture.  Then when instantiating, we'll find the capture via\nretrieve_local_specialization.  Once the closure type has been\nfinalized, it's frozen and we can't add new fields.  This is what\nhappens in the following test though, which is the reason we crash:\n\n  [&]<auto> {\n    [:e:];\n  }\n\nwhere while parsing we can't know what the splice will designate.\nWe'll only find out after we've substituted the splice but then it's\ntoo late to capture anything.\n\nA possible solution would be to speculatively capture all locals when\nwe see a dependent splice in a generic lambda.  But since this test is\ninvalid anyway, that would be a lot of work for no good reason.  So this\npatch changes the internal_error to an ordinary error.\n\n\tPR c++/123783\n\ngcc/cp/ChangeLog:\n\n\t* lambda.cc (add_capture): When trying to capture something in\n\tan instantiation of generic lambda, give an error instead of an ICE.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/dep14.C: New test.\n\t* g++.dg/reflect/dep15.C: New test.\n---\n gcc/cp/lambda.cc                     |  7 +++--\n gcc/testsuite/g++.dg/reflect/dep14.C | 44 ++++++++++++++++++++++++++++\n gcc/testsuite/g++.dg/reflect/dep15.C | 44 ++++++++++++++++++++++++++++\n 3 files changed, 93 insertions(+), 2 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/dep14.C\n create mode 100644 gcc/testsuite/g++.dg/reflect/dep15.C\n\n\nbase-commit: 662a21e48e7820c9f8614b4eb4249cc8d1dc443d",
    "diff": "diff --git a/gcc/cp/lambda.cc b/gcc/cp/lambda.cc\nindex e1ff304ffe8..bf9eda573e1 100644\n--- a/gcc/cp/lambda.cc\n+++ b/gcc/cp/lambda.cc\n@@ -729,8 +729,11 @@ add_capture (tree lambda, tree id, tree orig_init, bool by_reference_p,\n       && current_class_type == LAMBDA_EXPR_CLOSURE (lambda))\n     {\n       if (COMPLETE_TYPE_P (current_class_type))\n-\tinternal_error (\"trying to capture %qD in instantiation of \"\n-\t\t\t\"generic lambda\", id);\n+\t{\n+\t  error (\"trying to capture %qD in instantiation of generic lambda\",\n+\t\t id);\n+\t  return error_mark_node;\n+\t}\n       finish_member_declaration (member);\n     }\n \ndiff --git a/gcc/testsuite/g++.dg/reflect/dep14.C b/gcc/testsuite/g++.dg/reflect/dep14.C\nnew file mode 100644\nindex 00000000000..e9464e529b2\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/dep14.C\n@@ -0,0 +1,44 @@\n+// PR c++/123783\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+namespace __impl {\n+  template<auto... vals>\n+  struct replicator_type {\n+    template<typename F>\n+      constexpr void operator>>(F body) const {\n+        (body.template operator()<vals>(), ...);\n+      }\n+  };\n+\n+  template<auto... vals>\n+  replicator_type<vals...> replicator = {};\n+}\n+\n+template<typename R>\n+consteval auto expand(R range) {\n+  std::vector<std::meta::info> args;\n+  for (auto r : range) {\n+    args.push_back(reflect_constant(r));\n+  }\n+  return substitute(^^__impl::replicator, args);\n+}\n+\n+int func(int counter, float factor) {\n+    std::array<void *, parameters_of(^^func).size()> args;\n+\n+    std::size_t i = 0;\n+    [:expand(parameters_of(^^func)):] >> [&]<auto e>\n+    {\n+        args[i++] = &[:e:]; // { dg-error \"use of local variable|trying to capture \\[^\\n\\r]* in instantiation of generic lambda\" }\n+    };\n+    return 0;\n+}\n+\n+int main()\n+{\n+    func(11, 22);\n+    func(33, 44);\n+}\ndiff --git a/gcc/testsuite/g++.dg/reflect/dep15.C b/gcc/testsuite/g++.dg/reflect/dep15.C\nnew file mode 100644\nindex 00000000000..060c9f680ab\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/dep15.C\n@@ -0,0 +1,44 @@\n+// PR c++/123783\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+namespace __impl {\n+  template<auto... vals>\n+  struct replicator_type {\n+    template<typename F>\n+      constexpr void operator>>(F body) const {\n+        (body.template operator()<vals>(), ...);\n+      }\n+  };\n+\n+  template<auto... vals>\n+  replicator_type<vals...> replicator = {};\n+}\n+\n+template<typename R>\n+consteval auto expand(R range) {\n+  std::vector<std::meta::info> args;\n+  for (auto r : range) {\n+    args.push_back(reflect_constant(r));\n+  }\n+  return substitute(^^__impl::replicator, args);\n+}\n+\n+int func(int counter, float factor) {\n+    std::array<void *, parameters_of(^^func).size()> args;\n+\n+    std::size_t i = 0;\n+    [:expand(parameters_of(^^func)):] >> [&i, &counter, &factor, &args]<auto e>\n+    {\n+        args[i++] = &[:e:]; // { dg-error \"use of local variable\" }\n+    };\n+    return 0;\n+}\n+\n+int main()\n+{\n+    func(11, 22);\n+    func(33, 44);\n+}\n",
    "prefixes": []
}