Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2194905/?format=api
{ "id": 2194905, "url": "http://patchwork.ozlabs.org/api/patches/2194905/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/RJ_IMfkV_h9rh8RJhobN4Sm1Iv2qG-1mtU2hLPnDqPzV6Hkir8j4bOWlSolYRIoF-MQ6GaA-TWL_AfbMmRHm2Ls43ZuOfHL5wTXwbG4_wFk=@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": "<RJ_IMfkV_h9rh8RJhobN4Sm1Iv2qG-1mtU2hLPnDqPzV6Hkir8j4bOWlSolYRIoF-MQ6GaA-TWL_AfbMmRHm2Ls43ZuOfHL5wTXwbG4_wFk=@protonmail.com>", "list_archive_url": null, "date": "2026-02-10T08:00:09", "name": "[v2] c++/reflection: Allow address-splicing of non-static members [PR123660, PR123661]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "062bcb85de963d6d8251526a3ec83e35284e9fc4", "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/RJ_IMfkV_h9rh8RJhobN4Sm1Iv2qG-1mtU2hLPnDqPzV6Hkir8j4bOWlSolYRIoF-MQ6GaA-TWL_AfbMmRHm2Ls43ZuOfHL5wTXwbG4_wFk=@protonmail.com/mbox/", "series": [ { "id": 491616, "url": "http://patchwork.ozlabs.org/api/series/491616/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491616", "date": "2026-02-10T08:00:09", "name": "[v2] c++/reflection: Allow address-splicing of non-static members [PR123660, PR123661]", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/491616/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2194905/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2194905/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=Dn6zP17U;\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 (2048-bit key,\n secure) header.d=protonmail.com header.i=@protonmail.com header.a=rsa-sha256\n header.s=protonmail3 header.b=Dn6zP17U", "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.166" ], "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 4f9DXC1lx2z1xvb\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 19:00:57 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 1C4F94BA2E10\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 08:00:49 +0000 (GMT)", "from mail-43166.protonmail.ch (mail-43166.protonmail.ch\n [185.70.43.166])\n by sourceware.org (Postfix) with ESMTPS id 66C264BAE7CB\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 08:00:18 +0000 (GMT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org 1C4F94BA2E10", "OpenDKIM Filter v2.11.0 sourceware.org 66C264BAE7CB" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 66C264BAE7CB", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 66C264BAE7CB", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770710418; cv=none;\n b=XbW8M2Ewl2Hb5fENj25m9h/oJM7PBoFHaqGxw03W/YrXLYSd39uB+Q6Ac0cWCIQZ/AmAgJq5w5DdX/ib7P9x02qxROBVYryc7WLbykZ+742oGCj2OwcJaQKg8LPgdLksi9oLEJEEVGkNKNUyyyacXoCWeVhVnAVn4v2WC55WaPo=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770710418; c=relaxed/simple;\n bh=7lBwmTSlspyE9c46FKAgPM/XXHmL2QspTiDXvlfE/I4=;\n h=DKIM-Signature:Date:To:From:Subject:Message-ID:MIME-Version;\n b=O7slWkkwWyRZstNpccfQtbVmmKLHEnFf5nm/roPHlcyzjvuS0be92on7Ukde4qC65GCGDAyd8I4FHnnAxhd68j3u0dIc2eNgSfNU9yg4UJPrKd844Z7TiFv+DMlwy4lINUupxec0a0kUE9bKFk3mG3B/PVQgc3oSmwAzFuGbct8=", "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=1770710412; x=1770969612;\n bh=1kNQj9EEF473p/Kr3UaWzTSxGDZOR0isDSVFnPeBn30=;\n h=Date:To:From:Cc:Subject:Message-ID:In-Reply-To:References:\n Feedback-ID:From:To:Cc:Date:Subject:Reply-To:Feedback-ID:\n Message-ID:BIMI-Selector;\n b=Dn6zP17UIBGPB5uFGupj7PpvWkrIs9pdCYdjGNQ0v2X4AT6s9OHIRfcMiAbDEm09R\n R95WA7r16YTMNO8vvvgMEVTOvrk7J4UKxrqgg+u6mZbRMPssL1auttYty5ddQvFtwA\n RNNye8A9fekN5G/LfTCsZ445LdQUhW48iZbmb0jk8xoPZK6Aj3QW/YzZCwAVWLo0Ei\n leVeygq35ymzZZUzchzkdVrSaxc/mV6kWdGE8DIgmP3etRnLspGIiLT4whcPGOYUTb\n C9w2r6W2tz30liPI6Y5bmHuFFZgNzExPdDSKVYCFn2SWkGczTaM45tY24WHeltGokh\n 7dJYVh27qCP1A==", "Date": "Tue, 10 Feb 2026 08:00:09 +0000", "To": "Marek Polacek <polacek@redhat.com>", "From": "Boris Staletic <boris.staletic@protonmail.com>", "Cc": "Jason Merrill <jason@redhat.com>,\n \"gcc-patches@gcc.gnu.org\" <gcc-patches@gcc.gnu.org>", "Subject": "[PATCH v2] c++/reflection: Allow address-splicing of non-static\n members [PR123660, PR123661]", "Message-ID": "\n <RJ_IMfkV_h9rh8RJhobN4Sm1Iv2qG-1mtU2hLPnDqPzV6Hkir8j4bOWlSolYRIoF-MQ6GaA-TWL_AfbMmRHm2Ls43ZuOfHL5wTXwbG4_wFk=@protonmail.com>", "In-Reply-To": "<aYocQULe6N7MLPLy@redhat.com>", "References": "\n <_DD4SpzylKPGl3gGw_SrcsTF2vyhCkzLwAwNOpxnNFFbompQs2gg_gLt1RI0sF6DckMLdiCh29Y1Nmryb_xrjRzVQYQM8BPNfaHS3FBp2fg=@protonmail.com>\n <2619c114-ab42-4056-b781-a88c1dbe238e@redhat.com>\n <aYocQULe6N7MLPLy@redhat.com>", "Feedback-ID": "35547776:user:proton", "X-Pm-Message-ID": "35380530790182fc7e27768089146075c20d437f", "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": "On Monday, February 9th, 2026 at 5:41 PM, Marek Polacek <polacek@redhat.com> wrote:\n\n> \n> \n> On Mon, Feb 09, 2026 at 11:03:14PM +0900, Jason Merrill wrote:\n> \n> > On 2/8/26 6:43 PM, Boris Staletic wrote:\n> > \n> > > Bootstrapped and tested on x86_64-pc-linux-gnu.\n> > > -- >8 --\n> > > In case of expressions like `&[:expr:]` where `expr` depends on a\n> > > template parameter, and the splice expression represents a `FIELD_DECL` or\n> > > a non-static member `FUNCTION_DECL`, that's exactly what we'd pass on.\n> > > However, `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> > > \n> > > There's also a difference between the template argument being a type and\n> > > using `members_of()` to get to the reflections of members (in which case\n> > > evaluating the `SPLICE_EXPR` returns a `FUNCTION_DECL` - `splice8.C`\n> > > test) and passing `^^T::member` as the template argument (in which case\n> > > evaluating the `SPLICE_EXPR` returns a `BASELINK` - `splice9.C`).\n> > \n> > Thanks for the patch! A few commments below.\n> \n> \n> Also thanks for your bug reports! Note that the PR is in the ASSIGNED\n> state indicating that someone, in this case me, is already working on\n> the problem. I didn't get to this PR yet so it's fine -- I thought it\n> would depend on another bug fix that is on my plate, namely, not passing\n> ctx to finish_id_expression. Looks like it doesn't.\n> \n\nI did notice that the bug report had the ASSIGNED state, but I thought you\nalready had a lot to do and my intention was to help out.\nI first posted this patch to the bug tracker, but after no replies I thought\nit would have been fine to submit the patch for review.\n\n> > > 2026-02-08 Boris Staletic boris.staletic@protonmail.com\n> > > \n> > > PR c++/123660\n> > > PR c++/123661\n> > > * pt.cc (tsubst_expr): Handle pointers to non-static members\n> > > from splice expressions.\n> > > * g++.dg/reflect/splice10.C: New test.\n> > > * g++.dg/reflect/splice11.C: New test.\n> \n> \n> Note that we have separate ChangeLogs for cp/ and for testsuite/.\n> It's best to use gcc-mklog to auto-generate a ChangeLog skeleton.\n> Feel free to contact me off-list.\n\nI did notice that and thought I got the format right.\nAnyway, fixed now.\n\n> \n> > > Signed-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\n> > > \n> > > diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\n> > > index 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> > > op1 = tsubst_qualified_id (op1, args, complain, in_decl,\n> > > /done=/true, /address_p=/true);\n> > > else\n> > > - op1 = tsubst_non_call_postfix_expression (op1, args, complain,\n> > > - in_decl);\n> > > + {\n> > > + tree old_op1 = op1;\n> > > + op1 = tsubst_non_call_postfix_expression (op1, args, complain,\n> > > + in_decl);\n> > > + if (TREE_CODE (old_op1) == SPLICE_EXPR)\n> > > + {\n> > > + if (TREE_CODE (op1) == BASELINK)\n> > > + {\n> > > + tree fn = BASELINK_FUNCTIONS (op1);\n> > > + if (TREE_CODE (fn) == FUNCTION_DECL &&\n> > > + TREE_CODE (TREE_TYPE (op1) ) == METHOD_TYPE &&\n> > > + !TREE_STATIC (op1))\n> > > + op1 = fn;\n> > > + }\n> > \n> > It should be fine to just pass the BASELINK on to build_offset_ref. You can\n> > use BINFO_TYPE (BINFO_ACCESS_BINFO as the type argument.\n> \n> \n> BASELINK_ACCESS_BINFO\n\nDone.\n\n> \n> > > + if (TREE_CODE (op1) == FIELD_DECL ||\n> > > + (TREE_CODE (op1) == FUNCTION_DECL &&\n> > > + TREE_CODE (TREE_TYPE (op1)) == METHOD_TYPE &&\n> > > + !TREE_STATIC (TREE_TYPE (op1))))\n> > \n> > Operators like ||/&& go at the beginning of the line in our coding style.\n> > \n> > > + op1 = build_offset_ref(DECL_CONTEXT(op1), op1, true, complain);\n> > \n> > And space before (.\n> \n> \n> I would like this to be moved to tsubst_splice_expr (and I guess check\n> SPLICE_EXPR_ADDRESS_P).\n\nDone.\n\n> \n> > > + }\n> > > + }\n> > > RETURN (build_x_unary_op (input_location, ADDR_EXPR, op1,\n> > > templated_operator_saved_lookups (t),\n> > > complain|decltype_flag));\n> > > diff --git a/gcc/testsuite/g++.dg/reflect/splice10.C b/gcc/testsuite/g++.dg/reflect/splice10.C\n> > > new file mode 100644\n> > > index 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> \n> \n> I don't think this test needs to be dg-run, dg-compile should be enough.\n> \n\nI initially used dg-compile, but this pull request made me reconsider:\nhttps://gcc.gnu.org/pipermail/gcc-patches/2026-February/707791.html\n\nAnyway, changed to dg-dompile.\n\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> > > +}\n> > > diff --git a/gcc/testsuite/g++.dg/reflect/splice11.C b/gcc/testsuite/g++.dg/reflect/splice11.C\n> > > new file mode 100644\n> > > index 0000000000..6568afed07\n> > > --- /dev/null\n> > > +++ b/gcc/testsuite/g++.dg/reflect/splice11.C\n> > > @@ -0,0 +1,29 @@\n> \n> \n> I'd also add // PR c++/123661 here.\n\nDone.\n\n> \n> > > +// { dg-do run { target c++26 } }\n> \n> \n> Also dg-compile.\n\nDone.\n\n> \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> \n> \n> Marek\n\nHere's a v2 of the patch, 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` - `splice10.C`\ntest) and passing `^^T::member` as the template argument (in which case\nevaluating the `SPLICE_EXPR` returns a `BASELINK` - `splice11.C`).\n\nSigned-off-by: Boris Staletic <boris.staletic@protonmail.com>\n\n\tPR c++/123660\n\tPR c++/123661\n\ngcc/cp/ChangeLog:\n\n\t* pt.cc (tsubst_splice_expr): Handle pointers to non-static members\n\tfrom splice expressions\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/splice10.C: New test.\n\t* g++.dg/reflect/splice11.C: New test.\n---\n gcc/cp/pt.cc | 14 ++++++++++++\n gcc/testsuite/g++.dg/reflect/splice10.C | 28 ++++++++++++++++++++++++\n gcc/testsuite/g++.dg/reflect/splice11.C | 29 +++++++++++++++++++++++++\n 3 files changed, 71 insertions(+)\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..0c0076c9a4 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -16755,6 +16755,20 @@ tsubst_splice_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n op = splice (op);\n if (op == error_mark_node)\n return error_mark_node;\n+\n+ if (SPLICE_EXPR_ADDRESS_P (t) && !TREE_STATIC (TREE_TYPE (op)))\n+ {\n+ if (TREE_CODE (op) == BASELINK\n+\t && TREE_CODE (TREE_TYPE (op)) == METHOD_TYPE)\n+\top = build_offset_ref (BINFO_TYPE (BASELINK_ACCESS_BINFO (op)), op,\n+\t\t\t /*address_p=*/true, complain);\n+ else if (TREE_CODE (op) == FIELD_DECL\n+\t || (TREE_CODE (op) == FUNCTION_DECL\n+\t\t && TREE_CODE (TREE_TYPE (op)) == METHOD_TYPE))\n+\top = build_offset_ref (DECL_CONTEXT (op), op,\n+\t\t\t /*address_p=*/true, complain);\n+ }\n+\n if (dependent_splice_p (op))\n {\n if (SPLICE_EXPR_EXPRESSION_P (t))\ndiff --git a/gcc/testsuite/g++.dg/reflect/splice10.C b/gcc/testsuite/g++.dg/reflect/splice10.C\nnew file mode 100644\nindex 0000000000..2f335ea8fc\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/splice10.C\n@@ -0,0 +1,28 @@\n+// PR c++/123660\n+// PR c++/123661\n+// { dg-do compile { 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+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);\ndiff --git a/gcc/testsuite/g++.dg/reflect/splice11.C b/gcc/testsuite/g++.dg/reflect/splice11.C\nnew file mode 100644\nindex 0000000000..b62fdcc5ee\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/splice11.C\n@@ -0,0 +1,29 @@\n+// PR c++/123660\n+// PR c++/123661\n+// { dg-do compile { 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+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", "prefixes": [ "v2" ] }