get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2223886,
    "url": "http://patchwork.ozlabs.org/api/1.1/patches/2223886/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/aeC5t2bY4NkoD4nm@tucnak/",
    "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": "<aeC5t2bY4NkoD4nm@tucnak>",
    "date": "2026-04-16T10:28:07",
    "name": "c++: Reject splicing of function parameters [PR123783]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "30b0c7db58e4f18c765f57522b3ba960efebbfb4",
    "submitter": {
        "id": 671,
        "url": "http://patchwork.ozlabs.org/api/1.1/people/671/?format=api",
        "name": "Jakub Jelinek",
        "email": "jakub@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/aeC5t2bY4NkoD4nm@tucnak/mbox/",
    "series": [
        {
            "id": 500132,
            "url": "http://patchwork.ozlabs.org/api/1.1/series/500132/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500132",
            "date": "2026-04-16T10:28:07",
            "name": "c++: Reject splicing of function parameters [PR123783]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/500132/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2223886/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2223886/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=GNXFgGeq;\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=GNXFgGeq",
            "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 4fxDkm3YCHz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 20:28:47 +1000 (AEST)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 307354BA2E17\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 16 Apr 2026 10:28:45 +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 DBB104BA543C\n for <gcc-patches@gcc.gnu.org>; Thu, 16 Apr 2026 10:28:14 +0000 (GMT)",
            "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-694-J_LCyIXZONqYPZJQ3kaSNg-1; Thu,\n 16 Apr 2026 06:28:12 -0400",
            "from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17])\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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id E7A4B180049F\n for <gcc-patches@gcc.gnu.org>; Thu, 16 Apr 2026 10:28:11 +0000 (UTC)",
            "from tucnak.zalov.cz (unknown [10.44.33.129])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id 32B3F195608E; Thu, 16 Apr 2026 10:28:10 +0000 (UTC)",
            "from tucnak.zalov.cz (localhost [127.0.0.1])\n by tucnak.zalov.cz (8.18.1/8.18.1) with ESMTPS id 63GAS82A1008122\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Thu, 16 Apr 2026 12:28:08 +0200",
            "(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 63GAS88l1008121;\n Thu, 16 Apr 2026 12:28:08 +0200"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 307354BA2E17",
            "OpenDKIM Filter v2.11.0 sourceware.org DBB104BA543C"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org DBB104BA543C",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org DBB104BA543C",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776335295; cv=none;\n b=pW7P7EfeXDRIHaMSNVMr67QkpD7sp/hxdKJUwwPNQw6CYjhmshqh2NL67/v6gPzgvM0kwCkwCiI9wJroiqIps9zsBNYHB95Es1DtU+dzn4PVol4NEbZc3q13sbujqanwF5XwPPaSHpAHRNp11zlTMYsGC0cvggpadK7cdg53waQ=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776335295; c=relaxed/simple;\n bh=A8pcfvRR6Z4nxfXuRi1t5UVOpbnpxRI1p5FkYXjddoM=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=HMukaW4m6Gp+FW5pix3ZZnsjj7fOt4Oeybbwm5vxZxzlVIpXnBLiq3dQjlt0qA1j0zqbMEcYrTEYux5tlIDlSmR3yQDTlYz/fIszr0dfZefGadd4ET0hB7+Fwdojwiut4iw+3FKqxFwW0vuZS4veI3kP43otNWSHzEAwPbHIbmY=",
        "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=1776335294;\n h=from:from:reply-to:reply-to:subject:subject:date:date:\n message-id:message-id:to:to:cc:cc:mime-version:mime-version:\n content-type:content-type; bh=x1Q3YF7YfNxPjH6IRngGEPLfVNb0wVJJfVnX6qkCjp0=;\n b=GNXFgGeqV0VLRWruAKRGIxfDo5mB5ky8GICqzGdbozy5ZdkGoBVrYyPieZhUslvCsUeSwY\n FBT4Z8HRWKFrurbmY7BXUee3jq917jI2sWIXqwR3M8DS5zX0hqtmKt28B19eRzM6jfzrjJ\n ti+QIa/XYyuH5PUgDpn/64v3M+U0n9s=",
        "X-MC-Unique": "J_LCyIXZONqYPZJQ3kaSNg-1",
        "X-Mimecast-MFC-AGG-ID": "J_LCyIXZONqYPZJQ3kaSNg_1776335292",
        "Date": "Thu, 16 Apr 2026 12:28:07 +0200",
        "From": "Jakub Jelinek <jakub@redhat.com>",
        "To": "Jason Merrill <jason@redhat.com>, Marek Polacek <polacek@redhat.com>",
        "Cc": "gcc-patches@gcc.gnu.org",
        "Subject": "[PATCH] c++: Reject splicing of function parameters [PR123783]",
        "Message-ID": "<aeC5t2bY4NkoD4nm@tucnak>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.17",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "8439b7XUWcHzLtNJNXmVeRueImtLrJAGEwFbkxwuPyc_1776335292",
        "X-Mimecast-Originator": "redhat.com",
        "Content-Type": "text/plain; charset=us-ascii",
        "Content-Disposition": "inline",
        "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>",
        "Reply-To": "Jakub Jelinek <jakub@redhat.com>",
        "Errors-To": "gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org"
    },
    "content": "Hi!\n\nWhen discussing the PR last night, I've realized that we don't reject\nsplicing of function parameters, even when\nhttp://eel.is/c++draft/expr.prim.splice#2\ndoesn't list function parameters anywhere and so\nhttp://eel.is/c++draft/expr.prim.splice#2.7 should apply.\nNote, this is something that can't be tested in check_splice_expr,\nbecause REFLECT_EXPR_KIND isn't propagated to it and whether some\nreflection is a reflection of a function parameter or variable_of thereof\nonly differentiates in that kind, otherwise it is PARM_DECL in both\ncases.  So, the following patch diagnoses it in splice function.\nAnd for the case where using [:variable_of(e):] could make it valid\na message suggesting that is emitted too.\nIn mangle3.C I had to drop one test, it is now rejected and the\ntest tests mangling, so better shouldn't have errors in it.\nFor the dep14.C case, I've applied variable_of on it so that we get\nthe previous behavior.  And in func2 there it was actually (I think\nmistakenly) asking for paramete of func rather than func2, fixed that too.\n\nTested on x86_64-linux, ok for trunk if it passes full bootstrap/regtest?\n\n2026-04-16  Jakub Jelinek  <jakub@redhat.com>\n\n\tPR c++/123783\n\t* reflect.cc (splice): Reject splicing of function parameters.\n\n\t* g++.dg/reflect/mangle3.C: Remove f5<parameters_of (^^g)[0]>()\n\tcase.\n\t* g++.dg/reflect/dep14.C: Include <ranges>.\n\t(func): Apply variable_of to each vector member.\n\t(func2): Likewise.  Use ^^func2 instead of ^^func.\n\t* g++.dg/reflect/splice12.C: New test.\n\n\n\tJakub",
    "diff": "--- gcc/cp/reflect.cc.jj\t2026-04-15 08:52:04.297374316 +0200\n+++ gcc/cp/reflect.cc\t2026-04-16 11:39:30.763707538 +0200\n@@ -8510,6 +8510,18 @@ splice (tree refl)\n       return error_mark_node;\n     }\n \n+  if (REFLECT_EXPR_KIND (refl) == REFLECT_PARM)\n+    {\n+      auto_diagnostic_group d;\n+      error_at (cp_expr_loc_or_input_loc (refl),\n+\t\t\"cannot use a function parameter reflection in a splice \"\n+\t\t\"expression\");\n+      if (DECL_CONTEXT (REFLECT_EXPR_HANDLE (refl)) == current_function_decl)\n+\tinform (cp_expr_loc_or_input_loc (refl),\n+\t\t\"apply %<std::meta::variable_of%> on it before splicing\");\n+      return error_mark_node;\n+    }\n+\n   /* We are bringing some entity from the unevaluated expressions world\n      to possibly outside of that, mark it used.  */\n   if (!mark_used (REFLECT_EXPR_HANDLE (refl)))\n--- gcc/testsuite/g++.dg/reflect/mangle3.C.jj\t2026-04-15 09:57:58.778962876 +0200\n+++ gcc/testsuite/g++.dg/reflect/mangle3.C\t2026-04-16 11:47:13.739937787 +0200\n@@ -175,8 +175,6 @@ g (int p)\n // { dg-final { scan-assembler \"_Z2f5ILDmvlLi42EEEDtDST_EEv\" } }\n   f5<std::meta::reflect_object (arr[1])>();\n // { dg-final { scan-assembler \"_Z2f5ILDmobixL_Z3arrEL\\[ilx]1EEEDtDST_EEv\" } }\n-  f5<parameters_of (^^g)[0]>();\n-// { dg-final { scan-assembler \"_Z2f5ILDmpa_1giEEDtDST_EEv\" } }\n   f5<bases_of (^^S, ctx)[0]>();\n // { dg-final { scan-assembler \"_Z2f5ILDmba_1SEEDtDST_EEv\" } }\n   f6<Y>(Y{42});\n--- gcc/testsuite/g++.dg/reflect/dep14.C.jj\t2026-04-15 21:28:31.118011956 +0200\n+++ gcc/testsuite/g++.dg/reflect/dep14.C\t2026-04-16 12:10:13.009767880 +0200\n@@ -3,6 +3,7 @@\n // { dg-additional-options \"-freflection\" }\n \n #include <meta>\n+#include <ranges>\n \n namespace __impl {\n   template<auto... vals>\n@@ -30,7 +31,7 @@ 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+    [:expand(parameters_of(^^func) | std::views::transform(std::meta::variable_of)):] >> [&i, &counter, &factor, &args]<auto e>\n     {\n         args[i++] = &[:e:]; // { dg-error \"use of local variable\" }\n     };\n@@ -38,10 +39,10 @@ int func(int counter, float factor) {\n }\n \n int func2(int counter, float factor) {\n-    std::array<void *, parameters_of(^^func).size()> args;\n+    std::array<void *, parameters_of(^^func2).size()> args;\n \n     std::size_t i = 0;\n-    [:expand(parameters_of(^^func)):] >> [&]<auto e>\n+    [:expand(parameters_of(^^func2) | std::views::transform(std::meta::variable_of)):] >> [&]<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--- gcc/testsuite/g++.dg/reflect/splice12.C.jj\t2026-04-16 11:53:29.075638834 +0200\n+++ gcc/testsuite/g++.dg/reflect/splice12.C\t2026-04-16 12:05:05.248940576 +0200\n@@ -0,0 +1,21 @@\n+// PR c++/123783\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+void\n+bar (int a)\n+{\n+}\n+\n+void\n+foo (int a)\n+{\n+  auto b = &[: ^^a :];\n+  auto c = &[: variable_of (parameters_of (^^foo)[0]) :];\n+  auto d = &[: parameters_of (^^foo)[0] :];\t\t\t// { dg-error \"cannot use a function parameter reflection in a splice expression\" }\n+\t\t\t\t\t\t\t\t// { dg-message \"apply 'std::meta::variable_of' on it before splicing\" \"\" { target *-*-* } .-1 }\n+  auto e = &[: parameters_of (^^bar)[0] :];\t\t\t// { dg-error \"cannot use a function parameter reflection in a splice expression\" }\n+  auto f = [] { auto g = &[: parameters_of (^^foo)[0] :]; };\t// { dg-error \"cannot use a function parameter reflection in a splice expression\" }\n+}\n",
    "prefixes": []
}