Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194289/?format=api
{ "id": 2194289, "url": "http://patchwork.ozlabs.org/api/patches/2194289/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/_DD4SpzylKPGl3gGw_SrcsTF2vyhCkzLwAwNOpxnNFFbompQs2gg_gLt1RI0sF6DckMLdiCh29Y1Nmryb_xrjRzVQYQM8BPNfaHS3FBp2fg=@protonmail.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": "<_DD4SpzylKPGl3gGw_SrcsTF2vyhCkzLwAwNOpxnNFFbompQs2gg_gLt1RI0sF6DckMLdiCh29Y1Nmryb_xrjRzVQYQM8BPNfaHS3FBp2fg=@protonmail.com>", "list_archive_url": null, "date": "2026-02-08T09:43:31", "name": "c++/reflection: Allow address-splicing of non-static members [PR123660, PR123661]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "0d7fef509932d1b2a50ec596ee1003a9f9afdc0b", "submitter": { "id": 92603, "url": "http://patchwork.ozlabs.org/api/people/92603/?format=api", "name": "Boris Staletic", "email": "boris.staletic@protonmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/_DD4SpzylKPGl3gGw_SrcsTF2vyhCkzLwAwNOpxnNFFbompQs2gg_gLt1RI0sF6DckMLdiCh29Y1Nmryb_xrjRzVQYQM8BPNfaHS3FBp2fg=@protonmail.com/mbox/", "series": [ { "id": 491414, "url": "http://patchwork.ozlabs.org/api/series/491414/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491414", "date": "2026-02-08T09:43:31", "name": "c++/reflection: Allow address-splicing of non-static members [PR123660, PR123661]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491414/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194289/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194289/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 (2048-bit key;\n secure) header.d=protonmail.com header.i=@protonmail.com header.a=rsa-sha256\n header.s=protonmail3 header.b=Pw5zd4/s;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org\n (client-ip=38.145.34.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 (2048-bit key,\n secure) header.d=protonmail.com header.i=@protonmail.com header.a=rsa-sha256\n header.s=protonmail3 header.b=Pw5zd4/s", "sourceware.org; dmarc=pass (p=quarantine dis=none)\n header.from=protonmail.com", "sourceware.org; spf=pass smtp.mailfrom=protonmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=185.70.43.25" ], "Received": [ "from vm01.sourceware.org (vm01.sourceware.org [38.145.34.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 4f82wY2N8vz1xtr\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 08 Feb 2026 20:44:07 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 62C894C31837\n\tfor <incoming@patchwork.ozlabs.org>; Sun, 8 Feb 2026 09:44:05 +0000 (GMT)", "from mail-4325.protonmail.ch (mail-4325.protonmail.ch\n [185.70.43.25])\n by sourceware.org (Postfix) with ESMTPS id A39E34BBCDA8\n for <gcc-patches@gcc.gnu.org>; Sun, 8 Feb 2026 09:43:36 +0000 (GMT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 62C894C31837", "OpenDKIM Filter v2.11.0 sourceware.org A39E34BBCDA8" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org A39E34BBCDA8", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org A39E34BBCDA8", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770543816; cv=none;\n b=a4deAM1GBwP99Ll0YEZHmNzDr8OEeMOvrDlV14Bv0ilBn5jy+jLr/678/W0TsJFgGAdKTzBqM8Mqjwue/D7tx2zad601uCi28z2dAXsZBTpMw6tl+oQUtBP8wNnxkMj8a1E1Hli5UzEorvTGX+sniPzO3zhcTD28FpzG+ixLZug=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770543816; c=relaxed/simple;\n bh=s3DgBtgGHEVCeaPGom4pOQbQHApsjmvM+3uw9DQcGTI=;\n h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version;\n b=VhweDyVyBZFJri8WJSNcKIocwRGMEQ60Vf5tfxKcVPitkDOQ/E5Z5UgXA8d2opAa5r+0xtbVeLkL6ivfmPOiGEMFz8SLRuGZP9UEbTn6qtXtaoubIOJUqay8UMNysvJsLfDTBI5kL/LeNH7eNJ6pbMmteltE6jllxKNIDOXjEtk=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=protonmail.com;\n s=protonmail3; t=1770543815; x=1770803015;\n bh=fuzTT6WrctSfzMrWPu4roLuEE1xtEPUxVDOqS682YIA=;\n h=Date:To:From:Subject:Message-ID:Feedback-ID:From:To:Cc:Date:\n Subject:Reply-To:Feedback-ID:Message-ID:BIMI-Selector;\n b=Pw5zd4/sI/eWTyquLUqMFESDLy6ql2+J9KrZSlVRULqTQ7rpHORQHF9+3oyOLFVSB\n 52PszIoVClctY26NuaKHHaIOVnT2+f+NCtDKIG6HWhk7LG4a/1jFx8RRjzwSQCmCzo\n pnMAVCtn5iaiRj+rCz+PoezcBXTpLY0fccAowcNYaQwEtBFcX3Zd1ZJKWZ0ILAVkpO\n CWf5iSaErbiVrd0uHc4tOJ39/eNcsr+ssz9gohztxVFMg3rst2E2HsEIpevpP2VsUt\n YfciPDEQ35QLYHZbxIa+boqGQtHVrphjvIp/5OgE4zlFKiw+iqXvC4stCWGa6HITe5\n otIbdrcU5W/BA==", "Date": "Sun, 08 Feb 2026 09:43:31 +0000", "To": "\"gcc-patches@gcc.gnu.org\" <gcc-patches@gcc.gnu.org>,\n \"jason@redhat.com\" <jason@redhat.com>", "From": "Boris Staletic <boris.staletic@protonmail.com>", "Subject": "[PATCH] c++/reflection: Allow address-splicing of non-static members\n [PR123660, PR123661]", "Message-ID": "\n <_DD4SpzylKPGl3gGw_SrcsTF2vyhCkzLwAwNOpxnNFFbompQs2gg_gLt1RI0sF6DckMLdiCh29Y1Nmryb_xrjRzVQYQM8BPNfaHS3FBp2fg=@protonmail.com>", "Feedback-ID": "35547776:user:proton", "X-Pm-Message-ID": "13589aeafe267c7152de0c47614c718e63733e07", "MIME-Version": "1.0", "Content-Type": "text/plain; charset=utf-8", "Content-Transfer-Encoding": "quoted-printable", "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 and tested on x86_64-pc-linux-gnu.\n-- >8 --\nIn case of expressions like `&[:expr:]` where `expr` depends on a\ntemplate parameter, and the splice expression represents a `FIELD_DECL` or\na non-static member `FUNCTION_DECL`, that's exactly what we'd pass on.\nHowever, `build_x_unary_op()` for these expressions is expecting an\n`OFFSET_REF`. `OFFSET_REF` is also what gets passed to\n`build_x_unary_op()` when templates are not involved.\n\nThere's also a difference between the template argument being a type and\nusing `members_of()` to get to the reflections of members (in which case\nevaluating the `SPLICE_EXPR` returns a `FUNCTION_DECL` - `splice8.C`\ntest) and passing `^^T::member` as the template argument (in which case\nevaluating the `SPLICE_EXPR` returns a `BASELINK` - `splice9.C`).\n\n2026-02-08 Boris Staletic <boris.staletic@protonmail.com>\n\n\tPR c++/123660\n\tPR c++/123661\n\t* pt.cc (tsubst_expr): Handle pointers to non-static members\n\tfrom splice expressions.\n\t* g++.dg/reflect/splice10.C: New test.\n\t* g++.dg/reflect/splice11.C: New test.\n\nSigned-off-by: Boris Staletic <boris.staletic@protonmail.com>\n---\n gcc/cp/pt.cc | 23 +++++++++++++++++--\n gcc/testsuite/g++.dg/reflect/splice10.C | 30 +++++++++++++++++++++++++\n gcc/testsuite/g++.dg/reflect/splice11.C | 29 ++++++++++++++++++++++++\n 3 files changed, 80 insertions(+), 2 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/splice10.C\n create mode 100644 gcc/testsuite/g++.dg/reflect/splice11.C", "diff": "diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 049bbf07e0..fb1cd386e8 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -21454,8 +21454,27 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \top1 = tsubst_qualified_id (op1, args, complain, in_decl,\n \t\t\t\t /*done=*/true, /*address_p=*/true);\n else\n-\top1 = tsubst_non_call_postfix_expression (op1, args, complain,\n-\t\t\t\t\t\t in_decl);\n+\t{\n+\t tree old_op1 = op1;\n+\t op1 = tsubst_non_call_postfix_expression (op1, args, complain,\n+\t\t\t\t\t\t in_decl);\n+\t if (TREE_CODE (old_op1) == SPLICE_EXPR)\n+\t {\n+\t if (TREE_CODE (op1) == BASELINK)\n+\t\t{\n+\t\t tree fn = BASELINK_FUNCTIONS (op1);\n+\t\t if (TREE_CODE (fn) == FUNCTION_DECL &&\n+\t\t TREE_CODE (TREE_TYPE (op1) ) == METHOD_TYPE &&\n+\t\t !TREE_STATIC (op1))\n+\t\t op1 = fn;\n+\t\t}\n+\t if (TREE_CODE (op1) == FIELD_DECL ||\n+\t\t (TREE_CODE (op1) == FUNCTION_DECL &&\n+\t\t TREE_CODE (TREE_TYPE (op1)) == METHOD_TYPE &&\n+\t\t !TREE_STATIC (TREE_TYPE (op1))))\n+\t\top1 = build_offset_ref(DECL_CONTEXT(op1), op1, true, complain);\n+\t }\n+\t}\n RETURN (build_x_unary_op (input_location, ADDR_EXPR, op1,\n \t\t\t\ttemplated_operator_saved_lookups (t),\n \t\t\t\tcomplain|decltype_flag));\ndiff --git a/gcc/testsuite/g++.dg/reflect/splice10.C b/gcc/testsuite/g++.dg/reflect/splice10.C\nnew file mode 100644\nindex 0000000000..cbed421021\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/splice10.C\n@@ -0,0 +1,30 @@\n+// PR c++/123660\n+// PR c++/123661\n+// { dg-do run { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+struct s {\n+ int get_z(this s) { return 4; }\n+ static int get_y() { return 4; }\n+ int get_x() { return 3; }\n+ int xx;\n+ static int xxx;\n+};\n+\n+int s::xxx = 5;\n+\n+template<typename T, decltype(0uz) I>\n+constexpr auto test() {\n+ constexpr auto ctx = std::meta::access_context::current();\n+ return &[:members_of(^^T, ctx)[I]:];\n+}\n+\n+int main() {\n+ static_assert(test<s, 0uz>() == &s::get_z);\n+ static_assert(test<s, 1uz>() == &s::get_y);\n+ static_assert(test<s, 2uz>() == &s::get_x);\n+ static_assert(test<s, 3uz>() == &s::xx);\n+ static_assert(test<s, 4uz>() == &s::xxx);\n+}\ndiff --git a/gcc/testsuite/g++.dg/reflect/splice11.C b/gcc/testsuite/g++.dg/reflect/splice11.C\nnew file mode 100644\nindex 0000000000..6568afed07\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/splice11.C\n@@ -0,0 +1,29 @@\n+// { dg-do run { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+\n+void f() {}\n+struct s {\n+ int get_z(this s) { return 4; }\n+ static int get_y() { return 4; }\n+ int get_x() { return 3; }\n+ int xx;\n+ static int xxx;\n+};\n+\n+int s::xxx = 5;\n+\n+template<std::meta::info refl_expr>\n+constexpr auto test() {\n+ return &[:refl_expr:];\n+}\n+\n+int main() {\n+ static_assert(test<^^s::get_z>() == &s::get_z);\n+ static_assert(test<^^s::get_y>() == &s::get_y);\n+ static_assert(test<^^s::get_x>() == &s::get_x);\n+ static_assert(test<^^s::xx>() == &s::xx);\n+ static_assert(test<^^s::xxx>() == &s::xxx);\n+ static_assert(test<^^f>() == &f);\n+}\n", "prefixes": [] }