get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2216561,
    "url": "http://patchwork.ozlabs.org/api/patches/2216561/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/acWIXZwLjN_NOPLd@tucnak/",
    "project": {
        "id": 17,
        "url": "http://patchwork.ozlabs.org/api/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,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<acWIXZwLjN_NOPLd@tucnak>",
    "list_archive_url": null,
    "date": "2026-03-26T19:26:21",
    "name": "[RFC] c++: Implement CWG3119 - for-range-declaration of an expansion-statement as a templated entity",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "0bd02fe1f441af4c74e344579a4ec647f2e6e1fd",
    "submitter": {
        "id": 671,
        "url": "http://patchwork.ozlabs.org/api/people/671/?format=api",
        "name": "Jakub Jelinek",
        "email": "jakub@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/acWIXZwLjN_NOPLd@tucnak/mbox/",
    "series": [
        {
            "id": 497640,
            "url": "http://patchwork.ozlabs.org/api/series/497640/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497640",
            "date": "2026-03-26T19:26:21",
            "name": "[RFC] c++: Implement CWG3119 - for-range-declaration of an expansion-statement as a templated entity",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497640/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2216561/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2216561/checks/",
    "tags": {},
    "related": [],
    "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=XXAwoA9H;\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=XXAwoA9H",
            "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.129.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 4fhYgc0Sg8z1y1G\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 27 Mar 2026 06:27:06 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 3F2254B9DB7D\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 26 Mar 2026 19:27:04 +0000 (GMT)",
            "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id 265CC4B9DB42\n for <gcc-patches@gcc.gnu.org>; Thu, 26 Mar 2026 19:26:28 +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-527-U_zCC24kPHGif4FDRTV2eg-1; Thu,\n 26 Mar 2026 15:26:25 -0400",
            "from mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.93])\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 EB7EB1944EB3\n for <gcc-patches@gcc.gnu.org>; Thu, 26 Mar 2026 19:26:24 +0000 (UTC)",
            "from tucnak.zalov.cz (unknown [10.45.225.193])\n by mx-prod-int-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id 697D51800107; Thu, 26 Mar 2026 19:26:24 +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 62QJQLu13985055\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Thu, 26 Mar 2026 20:26:21 +0100",
            "(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 62QJQL293985054;\n Thu, 26 Mar 2026 20:26:21 +0100"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 3F2254B9DB7D",
            "OpenDKIM Filter v2.11.0 sourceware.org 265CC4B9DB42"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 265CC4B9DB42",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 265CC4B9DB42",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774553188; cv=none;\n b=W/djZGRv3jyyvtFcOTMZTj7mFWBwBd6q9Fd/rOTJXfGZ4m06qGl68ZHcJtoTYml8aituL+aXtSUZ5vv4dbDMeQJ+3nCpIUxchQZglHaQwSsac5pdTFFNMfaEf28K/JY7+QRlQJJitFlyA59fYg3B/w/s+lI37Be6gbBieijeG88=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774553188; c=relaxed/simple;\n bh=n+t9ftvyRRy6FHCYL6tzPBqE1dFYpaeK701gO55IXac=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=rVw8b9A/l4r8LJW22TUBMIJ7ZqvOH3I0jgnLVRf8ajZeLOYwc/6++HGBu1oioO4yfkzW/WR/JLQIPy8+I3d3l39M8YzK/yoYB+9isfSy341RY64OxHViVP0o074KwhwhoYwtb5feSfOj1zyPk6giEjN+DmqEEk2hy684GWir78E=",
        "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=1774553187;\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=dynh3rade6Mzr03n/7IKUpaiAgYe9vUqbV+5hIUDZkI=;\n b=XXAwoA9H+2NMb/KABHvSGNe+Cavmv3GXLywpnTzGTsgGDjR6Do7wSoO0w3io/BEOQculfH\n ix8bfAwy/h8vzTvM2DbcAaT3UeCFvpjDNUqi31Ld8pDAiOaCYbw1bJIgV3gAK4+KtVSmbj\n 20OxzzKNvrwl5pw+h9Q/OuxUA1qbcPE=",
        "X-MC-Unique": "U_zCC24kPHGif4FDRTV2eg-1",
        "X-Mimecast-MFC-AGG-ID": "U_zCC24kPHGif4FDRTV2eg_1774553185",
        "Date": "Thu, 26 Mar 2026 20:26:21 +0100",
        "From": "Jakub Jelinek <jakub@redhat.com>",
        "To": "Jason Merrill <jason@redhat.com>",
        "Cc": "gcc-patches@gcc.gnu.org",
        "Subject": "[RFC PATCH] c++: Implement CWG3119 - for-range-declaration of an\n expansion-statement as a templated entity",
        "Message-ID": "<acWIXZwLjN_NOPLd@tucnak>",
        "MIME-Version": "1.0",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.93",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "14TvqEkgGDLnXCh11NjqLAeO8chnz_zsX925fnGOdrs_1774553185",
        "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\nThe following patch implements the proposed resolution of\nhttps://wg21.link/cwg3119\nTemporarily setting processing_template_decl around the\ncp_parser_simple_declaration causes all kinds of ICEs and miscompilations,\nthis patch just sets in_expansion_stmt around it and allows the sb\npack in that case.\n\nTested on x86_64-linux.\n\n2026-03-26  Jakub Jelinek  <jakub@redhat.com>\n\n\t* parser.cc (cp_parser_expansion_statement): Temporarily set\n\tin_expansion_stmt to true around cp_parser_simple_declaration\n\tfor range_decl.\n\t(cp_parser_decomposition_declaration): Don't reject structured binding\n\tpacks if in_expansion_stmt is set.\n\n\t* g++.dg/cpp26/expansion-stmt34.C: New test.\n\n\n\tJakub",
    "diff": "--- gcc/cp/parser.cc.jj\t2026-03-23 11:26:45.807386878 +0100\n+++ gcc/cp/parser.cc\t2026-03-26 20:03:18.398967675 +0100\n@@ -16601,6 +16601,8 @@ cp_parser_expansion_statement (cp_parser\n   /* A colon is used in expansion-statement.  */\n   parser->colon_corrects_to_scope_p = false;\n \n+  in_expansion_stmt = true;\n+\n   /* Parse the declaration.  */\n   tree range_decl;\n   cp_parser_simple_declaration (parser,\n@@ -16609,6 +16611,7 @@ cp_parser_expansion_statement (cp_parser\n   if (range_decl == NULL_TREE)\n     range_decl = error_mark_node;\n   parser->colon_corrects_to_scope_p = saved_colon_corrects_to_scope_p;\n+  in_expansion_stmt = save_in_expansion_stmt;\n \n   cp_parser_require (parser, CPP_COLON, RT_COLON);\n \n@@ -18249,7 +18252,7 @@ cp_parser_decomposition_declaration (cp_\n \tif (cp_lexer_next_token_is (parser->lexer, CPP_ELLIPSIS))\n \t  {\n \t    location_t elloc = cp_lexer_peek_token (parser->lexer)->location;\n-\t    if (!processing_template_decl)\n+\t    if (!processing_template_decl && !in_expansion_stmt)\n \t      error_at (elloc, \"structured binding pack outside of template\");\n \t    else if (pack != -1)\n \t      error_at (elloc,\n--- gcc/testsuite/g++.dg/cpp26/expansion-stmt34.C.jj\t2026-03-26 20:10:15.713887376 +0100\n+++ gcc/testsuite/g++.dg/cpp26/expansion-stmt34.C\t2026-03-26 20:15:42.434344130 +0100\n@@ -0,0 +1,40 @@\n+// CWG3119 - for-range-declaration of an expansion-statement as a templated\n+// entity.\n+// { dg-do run { target c++26 } }\n+\n+namespace std {\n+  using size_t = decltype (sizeof 0);\n+  template<typename T> struct tuple_size;\n+  template<size_t, typename> struct tuple_element;\n+}\n+struct B { int a; long b; };\n+struct C { char a; short b; int c; long d; long long e; float f; };\n+struct E { char a; template <int I> char &get () { return a; } };\n+\n+template <> struct std::tuple_size <E> { static const int value = 7; };\n+template <std::size_t I> struct std::tuple_element <I, E> { using type = char; };\n+\n+struct A\n+{\n+  B b;\n+  C c;\n+  int d[3];\n+  E e;\n+};\n+\n+template <typename ...T>\n+int\n+foo (T... x)\n+{\n+  return sizeof... (x);\n+}\n+\n+int\n+main ()\n+{\n+  int ret = 0;\n+  template for (auto [...e] : A ())\n+    ret += foo (e...);\n+  if (ret != 18)\n+    __builtin_abort ();\n+}\n",
    "prefixes": [
        "RFC"
    ]
}