get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 2218746,
    "url": "http://patchwork.ozlabs.org/api/patches/2218746/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260401202927.935182-1-polacek@redhat.com/",
    "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": "<20260401202927.935182-1-polacek@redhat.com>",
    "list_archive_url": null,
    "date": "2026-04-01T20:29:27",
    "name": "c++/reflection: fix wrong-code with members_of [PR124646, PR124645]",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "ca633295744ac971ec525296b2f5e948889f9838",
    "submitter": {
        "id": 14370,
        "url": "http://patchwork.ozlabs.org/api/people/14370/?format=api",
        "name": "Marek Polacek",
        "email": "polacek@redhat.com"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260401202927.935182-1-polacek@redhat.com/mbox/",
    "series": [
        {
            "id": 498386,
            "url": "http://patchwork.ozlabs.org/api/series/498386/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=498386",
            "date": "2026-04-01T20:29:27",
            "name": "c++/reflection: fix wrong-code with members_of [PR124646, PR124645]",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/498386/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/2218746/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/2218746/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=Lf+n5cgh;\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=Lf+n5cgh",
            "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 4fmGnY3cmjz1yCs\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 02 Apr 2026 07:30:09 +1100 (AEDT)",
            "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 92D894BA23D9\n\tfor <incoming@patchwork.ozlabs.org>; Wed,  1 Apr 2026 20:30:07 +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 96BD04BA2E2B\n for <gcc-patches@gcc.gnu.org>; Wed,  1 Apr 2026 20:29:38 +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-610-Ejv4hN3sNK6-o161nWqPBQ-1; Wed,\n 01 Apr 2026 16:29:37 -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-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 3E87A1956048\n for <gcc-patches@gcc.gnu.org>; Wed,  1 Apr 2026 20:29:36 +0000 (UTC)",
            "from pdp-11.lan (unknown [10.22.64.225])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id BA5DE1954102; Wed,  1 Apr 2026 20:29:35 +0000 (UTC)"
        ],
        "DKIM-Filter": [
            "OpenDKIM Filter v2.11.0 sourceware.org 92D894BA23D9",
            "OpenDKIM Filter v2.11.0 sourceware.org 96BD04BA2E2B"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 96BD04BA2E2B",
        "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 96BD04BA2E2B",
        "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775075378; cv=none;\n b=E24SPGEGDLyOwdtqSVPvbjQTZyjndZlD6D5TUX1VQsn2W+c9V+F6dfK6BDFxyZSE5riAAzJkGiyqtfYV2qBCIkxMg9Ej5k+h7FZj6PnnlJvrJ7DdDuD6g91+EN+vGzMIG8fF6Tp5kRzetu8u7upGY/b/itWVRYIly829kBRtiv4=",
        "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775075378; c=relaxed/simple;\n bh=OhJKz0e863PxaDAF1C22TVeHIlSGg8LgNkYUSLYbJV4=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=ZajQ6lAE5d2ZqQBumj6GJonVdyBhSylMb+YSgrMoAVc9CfH1OVztKzxO8bBhsaTxa9R7pU1CW9jsgBYlw0CtXCgutWi1CMfl7j9HOob/ZD/TpMhQ+x43R3XeCJVLlq6d9PurrWPK9OqYUWyPjpz5Xu3TJBJEiisRlDZLDw6T5X0=",
        "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=1775075378;\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=JV4RYFjnpN2bS0VMq+gbLg8X1HoQyzXPTRcJ4Ha8CDM=;\n b=Lf+n5cghJSuaeCcU/8DMvrpCN3obG2zP5IWpBvYnkmhVBBcerNCH1773BFVK2vOHALieT1\n uXBVMxcmIUkY2/2ClcUZeWrzrcNoPoVLPd6Q1BVnk2RWrlwMvao/jv4RZjeBdBg94iHjZv\n bYZNFtIM/y69Zv2FxfJzG5qK919amio=",
        "X-MC-Unique": "Ejv4hN3sNK6-o161nWqPBQ-1",
        "X-Mimecast-MFC-AGG-ID": "Ejv4hN3sNK6-o161nWqPBQ_1775075376",
        "From": "Marek Polacek <polacek@redhat.com>",
        "To": "GCC Patches <gcc-patches@gcc.gnu.org>,\n\tJason Merrill <jason@redhat.com>",
        "Subject": "[PATCH] c++/reflection: fix wrong-code with members_of [PR124646,\n PR124645]",
        "Date": "Wed,  1 Apr 2026 16:29:27 -0400",
        "Message-ID": "<20260401202927.935182-1-polacek@redhat.com>",
        "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": "1duma5Qrvulr9Ac9n_2Wd8-j2xjqiF3dEmHjJz-aZ5Q_1775075376",
        "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 --\nMy r16-8235 change should have set DECL_EXTERNAL only in the\n!at_function_scope_p block, before rest_of_decl_compilation.  Setting\nDECL_EXTERNAL on the temporary var for both at_function_scope_p and\n!at_function_scope_p cases causes issues: in members_of11.C, we wrongly\ninitialize 'mem' in the loop to A::a both times, insted of A::a and B::b.\nSimilarly in members_of12.C we wrongly initialize member when inspecting\nns2.\n\nI couldn't track down where *exactly* things go wrong, but the point\nof r16-8235 was to set DECL_EXTERNAL only for the rest_of_decl_compilation\ncall.\n\n\tPR c++/124646\n\tPR c++/124645\n\ngcc/cp/ChangeLog:\n\n\t* call.cc (set_up_extended_ref_temp): Move setting DECL_EXTERNAL\n\tto the !at_function_scope_p block.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/members_of11.C: New test.\n\t* g++.dg/reflect/members_of12.C: New test.\n---\n gcc/cp/call.cc                              |  8 ++---\n gcc/testsuite/g++.dg/reflect/members_of11.C | 26 +++++++++++++++\n gcc/testsuite/g++.dg/reflect/members_of12.C | 37 +++++++++++++++++++++\n 3 files changed, 67 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/members_of11.C\n create mode 100644 gcc/testsuite/g++.dg/reflect/members_of12.C\n\n\nbase-commit: 24336625bb26102f393c8c58d63c1cb0f24cbb1a",
    "diff": "diff --git a/gcc/cp/call.cc b/gcc/cp/call.cc\nindex 36703c587eb..92c3a23ab8d 100644\n--- a/gcc/cp/call.cc\n+++ b/gcc/cp/call.cc\n@@ -14351,10 +14351,6 @@ set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups,\n   /* Any reference temp has a non-trivial initializer.  */\n   DECL_NONTRIVIALLY_INITIALIZED_P (var) = true;\n \n-  /* Don't output reflection variables.  */\n-  if (consteval_only_p (var))\n-    DECL_EXTERNAL (var) = true;\n-\n   /* If the initializer is constant, put it in DECL_INITIAL so we get\n      static initialization and use in constant expressions.  */\n   init = maybe_constant_init (expr, var, /*manifestly_const_eval=*/true);\n@@ -14467,6 +14463,10 @@ set_up_extended_ref_temp (tree decl, tree expr, vec<tree, va_gc> **cleanups,\n     }\n   else\n     {\n+      /* Don't output reflection variables.  */\n+      if (consteval_only_p (var))\n+\tDECL_EXTERNAL (var) = true;\n+\n       rest_of_decl_compilation (var, /*toplev=*/1, at_eof);\n       if (TYPE_HAS_NONTRIVIAL_DESTRUCTOR (type))\n \t{\ndiff --git a/gcc/testsuite/g++.dg/reflect/members_of11.C b/gcc/testsuite/g++.dg/reflect/members_of11.C\nnew file mode 100644\nindex 00000000000..098981910fc\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/members_of11.C\n@@ -0,0 +1,26 @@\n+// PR c++/124646\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+struct A { int a; };\n+struct B { int b; };\n+\n+consteval auto nsdms(std::meta::info i) {\n+  return define_static_array(nonstatic_data_members_of(i, std::meta::access_context::unchecked()));\n+}\n+\n+consteval void print_nsdms(std::meta::info i) {\n+    auto msg = std::string(\"members of \") + display_string_of(i) + \" are:\";\n+    for (auto mem : nsdms(i)) {\n+        msg += \" \";\n+        msg += display_string_of(mem);\n+    }\n+    __builtin_constexpr_diag(0, \"\", msg); // { dg-message \"members of B are: B::b\" }\n+}\n+\n+consteval {\n+    print_nsdms(^^A);\n+    print_nsdms(^^B);\n+}\ndiff --git a/gcc/testsuite/g++.dg/reflect/members_of12.C b/gcc/testsuite/g++.dg/reflect/members_of12.C\nnew file mode 100644\nindex 00000000000..198ef335421\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/members_of12.C\n@@ -0,0 +1,37 @@\n+// PR c++/124645\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+namespace reg\n+{\n+template <auto namespace_info>\n+struct derived_type_registry\n+{\n+  static consteval auto\n+      reflected_types(std::meta::info scope = namespace_info)\n+  {\n+    std::vector<std::meta::info> infos;\n+\n+    for(auto member : members_of(scope, std::meta::access_context::unchecked()))\n+    {\n+      if (member == std::meta::info{}) continue;\n+    }\n+\n+    return infos;\n+  }\n+};\n+}\n+\n+namespace ns1 {\n+    struct test {};\n+}\n+\n+namespace ns2 {\n+}\n+\n+static_assert(reg::derived_type_registry<^^ns1>::reflected_types().empty());\n+static_assert(reg::derived_type_registry<^^ns1>::reflected_types().size() == 0);\n+static_assert(reg::derived_type_registry<^^ns2>::reflected_types().empty());\n+static_assert(reg::derived_type_registry<^^ns2>::reflected_types().size() == 0);\n",
    "prefixes": []
}