get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2217406,
    "url": "http://patchwork.ozlabs.org/api/patches/2217406/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/acgHVpnNLJ1qrlu7@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": "<acgHVpnNLJ1qrlu7@tucnak>",
    "list_archive_url": null,
    "date": "2026-03-28T16:52:39",
    "name": "c++, v2: 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/acgHVpnNLJ1qrlu7@tucnak/mbox/",
    "series": [
        {
            "id": 497881,
            "url": "http://patchwork.ozlabs.org/api/series/497881/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=497881",
            "date": "2026-03-28T16:52:39",
            "name": "c++, v2: Implement CWG3119 - for-range-declaration of an expansion-statement as a templated entity",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/497881/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2217406/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2217406/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=HJCYM33U;\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=HJCYM33U",
            "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 4fjkMs4K7Sz1y1j\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 29 Mar 2026 04:02:33 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 77CD74BA23C2\n\tfor <incoming@patchwork.ozlabs.org>; Sat, 28 Mar 2026 17:02:31 +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 6210F4B9DB43\n for <gcc-patches@gcc.gnu.org>; Sat, 28 Mar 2026 16:58:12 +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-479-NXMAnwgMPY27aMd0GgC0sw-1; Sat,\n 28 Mar 2026 12:58:09 -0400",
            "from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\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 AA55019560AA\n for <gcc-patches@gcc.gnu.org>; Sat, 28 Mar 2026 16:58:08 +0000 (UTC)",
            "from tucnak.zalov.cz (unknown [10.44.32.9])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with\n ESMTPS\n id 3C6CF1800361; Sat, 28 Mar 2026 16:58:08 +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 62SGw5d21667418\n (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NOT);\n Sat, 28 Mar 2026 17:58:05 +0100",
            "(from jakub@localhost)\n by tucnak.zalov.cz (8.18.1/8.18.1/Submit) id 62SGw5qb1667417;\n Sat, 28 Mar 2026 17:58:05 +0100"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 77CD74BA23C2",
            "OpenDKIM Filter v2.11.0 sourceware.org 6210F4B9DB43"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 6210F4B9DB43",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 6210F4B9DB43",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1774717092; cv=none;\n b=HFgOML8Y2ILfYOqE+Q1WZPPXG0vQuA6eVazIFV4o+x0IF3wdvqvwyOCLG2v0GYkr/EENMuX2r8KWi97shYZNvtSP6kopeze5yJ0SAlcsgEsGd9VZBmai/FXo+eaL5aUw0f3MAqLlby1jp2kduQV4JDrE0hNOFyYItucN/OR6+CE=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1774717092; c=relaxed/simple;\n bh=++3PYQa6a45igt8J1qzKkVHL5HmXHC8yUaZenOHf2D0=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=ftTch0v4M45fyf7onIzKp24rzAjp4cwaHtZCojRgcZNBAeY5Cw5DnovpDPvtWec5j3x9FUQ5XMR7kOtY9EJR9D+v8eBwM4o5oy0NjWmSwJg901dqjD4c8hDCkMhfz1cWgLEOqO8xtYSDgXbs4UelXYw2oXFI9hBbTA5NntbXQuw=",
        "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=1774717092;\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:resent-to:resent-from:resent-message-id:\n in-reply-to:in-reply-to:references:references;\n bh=ijXplyWKOlx+4JNPE60N8E5ziXEfYHBCz2FSKV78Rq0=;\n b=HJCYM33UQV6Thu+QYM5mOJKUJ8MIZ38HbtCxHEi22gLfbxVwX91Wdo5dHAL1ER0NO7RAq8\n 9CrqHflrIRUPhRKmvO7peV6UkJgH8v4xgwHDdSWcTLPFAGA4n9WxNSVASF9u0WFFXSq5vS\n jRdyFfoQjmwqiiX7vLdcYi7r2i8RAb8=",
        "X-MC-Unique": "NXMAnwgMPY27aMd0GgC0sw-1",
        "X-Mimecast-MFC-AGG-ID": "NXMAnwgMPY27aMd0GgC0sw_1774717088",
        "Resent-From": "Jakub Jelinek <jakub@redhat.com>",
        "Resent-Date": "Sat, 28 Mar 2026 17:58:05 +0100",
        "Resent-Message-ID": "<acgIneU6L_ddKPIH@tucnak>",
        "Resent-To": "Jason Merrill <jason@redhat.com>, gcc-patches@gcc.gnu.org",
        "Date": "Sat, 28 Mar 2026 17:52:39 +0100",
        "From": "Jakub Jelinek <jakub@redhat.com>",
        "To": "Jason Merrill <jason@redhat.com>",
        "Cc": "gcc-patches@gcc.gnu.org",
        "Subject": "[PATCH] c++, v2: Implement CWG3119 - for-range-declaration of an\n expansion-statement as a templated entity",
        "Message-ID": "<acgHVpnNLJ1qrlu7@tucnak>",
        "References": "<acWIXZwLjN_NOPLd@tucnak>",
        "MIME-Version": "1.0",
        "In-Reply-To": "<acWIXZwLjN_NOPLd@tucnak>",
        "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.111",
        "X-Mimecast-Spam-Score": "0",
        "X-Mimecast-MFC-PROC-ID": "rM0vm223wJ_WlITdiKYpeEEHcReCQgSmxEO5aydNbas_1774717088",
        "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": "On Thu, Mar 26, 2026 at 08:26:21PM +0100, Jakub Jelinek wrote:\n> The following patch implements the proposed resolution of\n> https://wg21.link/cwg3119\n> Temporarily setting processing_template_decl around the\n> cp_parser_simple_declaration causes all kinds of ICEs and miscompilations,\n> this patch just sets in_expansion_stmt around it and allows the sb\n> pack in that case.\n\nReposting as no longer RFC PATCH.\nBootstrapped/regtested on x86_64-linux and i686-linux, ok for trunk?\n\n2026-03-28  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\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": []
}