Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2195239/?format=api
{ "id": 2195239, "url": "http://patchwork.ozlabs.org/api/patches/2195239/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260210160554.664693-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": "<20260210160554.664693-1-polacek@redhat.com>", "list_archive_url": null, "date": "2026-02-10T16:05:54", "name": "c++/reflection: splices and passing ctx to finish_id_expr", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "b0d6b6ddd1f0fb76a26ca69e3849b093f905952c", "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/20260210160554.664693-1-polacek@redhat.com/mbox/", "series": [ { "id": 491699, "url": "http://patchwork.ozlabs.org/api/series/491699/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=491699", "date": "2026-02-10T16:05:54", "name": "c++/reflection: splices and passing ctx to finish_id_expr", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/491699/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2195239/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2195239/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=GE3npEeL;\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=GE3npEeL", "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 4f9RJh51rDz1xwG\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 11 Feb 2026 03:06:43 +1100 (AEDT)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D101D4BA2E08\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 10 Feb 2026 16:06:38 +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 3A8744BA2E10\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 16:06:09 +0000 (GMT)", "from mx-prod-mc-06.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-686-2V0F69ShNNOtsA7Z-Lj-bA-1; Tue,\n 10 Feb 2026 11:06:06 -0500", "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-06.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id AAADD18001DE\n for <gcc-patches@gcc.gnu.org>; Tue, 10 Feb 2026 16:06:04 +0000 (UTC)", "from pdp-11.redhat.com (unknown [10.22.88.240])\n by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 19D8D1956053; Tue, 10 Feb 2026 16:06:03 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org D101D4BA2E08", "OpenDKIM Filter v2.11.0 sourceware.org 3A8744BA2E10" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 3A8744BA2E10", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 3A8744BA2E10", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1770739569; cv=none;\n b=j/jNWOtOQi8C40DMsFbyOb9Q8Xg1pXBgH/xy7I9opbX/C2zYkRigK+PZH2cBb4llqySllmt4IO+UntNMzKtfNtJJcxFGtmAaKTExiAF1HRbKgyhrBTbviSX/68jF+HhRURZesK0dNenWQd2zlP5OEBlGFLP/ax2y31evhJcoauU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1770739569; c=relaxed/simple;\n bh=G/Ffrsy+cIdU4LFBu14HWzEqWVeFzB3iixQZeDTzKA4=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=XaC05EO+jNtdmK6VEewthYZgMXTN9uVIg+VOwtmwczq2y3/PywA+JBploH95Nyr4xNZwLyn/t+YSR+WE6smCV1r82ddTfZnRJ/JlEtNNmii3Vfrmj7g/sTx/Uw00hzTTsKjBQTmLEC7V9pU2r7zWbBmIuWspCqyywn5Yc6mgSEs=", "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=1770739568;\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=04Pqhfx4Jii5rBz6OhlcGwSPeWXczOsy2wJftvryy6M=;\n b=GE3npEeL2FKfyXDizKVlrMsbEtAQAN2sMH39LsfrvbUXUmBeigU8G2uWp/tqtFPcF2wxha\n 1zjGkmnDTrioKj8VLFDViCg9aJvzsCRb9BP4ir1I5HOzOfwOKL1izuY1yxln+SxHJ82xCg\n +zAvz5cKighdCjW5IZWXfRCZbR2j5XU=", "X-MC-Unique": "2V0F69ShNNOtsA7Z-Lj-bA-1", "X-Mimecast-MFC-AGG-ID": "2V0F69ShNNOtsA7Z-Lj-bA_1770739565", "From": "Marek Polacek <polacek@redhat.com>", "To": "Jason Merrill <jason@redhat.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>", "Subject": "[PATCH] c++/reflection: splices and passing ctx to finish_id_expr", "Date": "Tue, 10 Feb 2026 11:05:54 -0500", "Message-ID": "<20260210160554.664693-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": "HuZuc_euiu3PPcmoLgaPPYwxdYKiDdc-Y_P0suQ1KTo_1770739565", "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 --\nIn <https://gcc.gnu.org/pipermail/gcc-patches/2026-January/705175.html>\n(bottom of the message) we discussed not passing ctx to finish_id_expression\nso that we can get rid of the _deferring_access_checks calls. So the\ncp_parser_splice_expression changes are what we want. In order to be\nable to do that, I had to adjust finish_id_expression_1 so that things\nlike &[: ^^S::fn :] and &[: ^^S::mem :] keep working.\n\ngcc/cp/ChangeLog:\n\n\t* cp-tree.h (finish_id_expression): Adjust declaration.\n\t* parser.cc (cp_parser_splice_expression): Don't defer access checking.\n\tDon't pass context to finish_id_expression. Call finish_id_expression\n\twith splice_p = true.\n\t(cp_parser_primary_expression): Adjust the call to finish_id_expression.\n\t(cp_parser_lambda_introducer): Likewise.\n\t(cp_parser_decltype_expr): Likewise.\n\t(cp_finish_omp_declare_variant): Likewise.\n\t* pt.cc (tsubst_expr): Likewise.\n\t* semantics.cc (finish_id_expression_1): New splice_p parameter.\n\tFor FIELD_DECLs and functions, call build_offset_ref when taking\n\tthe address when the entity was designated by a splice-expression.\n\tUse nullptr. Allow a VAR_DECL in an assert.\n\t(finish_id_expression): New splice_p parameter. Use it.\n\t(omp_reduction_lookup): Adjust the call to finish_id_expression.\n---\n gcc/cp/cp-tree.h | 2 +-\n gcc/cp/parser.cc | 21 +++++++--------------\n gcc/cp/pt.cc | 1 +\n gcc/cp/semantics.cc | 41 +++++++++++++++++++++++++++++------------\n 4 files changed, 38 insertions(+), 27 deletions(-)\n\n\nbase-commit: 065a6ab3747fe9116643ac6754582bc195847bfc", "diff": "diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h\nindex fcad67a662c..99f4c2fc2e4 100644\n--- a/gcc/cp/cp-tree.h\n+++ b/gcc/cp/cp-tree.h\n@@ -8443,7 +8443,7 @@ extern tree process_outer_var_ref\t\t(tree, tsubst_flags_t, bool force_use = false\n extern cp_expr finish_id_expression\t\t(tree, tree, tree,\n \t\t\t\t\t\t cp_id_kind *,\n \t\t\t\t\t\t bool, bool, bool *,\n-\t\t\t\t\t\t bool, bool, bool, bool,\n+\t\t\t\t\t\t bool, bool, bool, bool, bool,\n \t\t\t\t\t\t const char **,\n location_t);\n extern tree finish_typeof\t\t\t(tree);\ndiff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 8c46b260fff..a7ad4876ac3 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -6395,18 +6395,8 @@ cp_parser_splice_expression (cp_parser *parser, bool template_p,\n \t a variable template. For &[: ^^S::x :], we have to create an\n \t OFFSET_REF. For a VAR_DECL, we need the convert_from_reference. */\n cp_unevaluated u;\n- /* CWG 3109 adjusted [class.protected] to say that checking access to\n-\t protected non-static members is disabled for members designated by a\n-\t splice-expression. */\n- push_deferring_access_checks (dk_no_check);\n const char *error_msg;\n- /* We don't have the parser scope here, so figure out the context. In\n-\t struct S { static constexpr int i = 42; };\n-\t constexpr auto r = ^^S::i;\n-\t int i = [: r :];\n-\t we need to pass down 'S'. */\n- tree ctx = DECL_P (t) ? DECL_CONTEXT (t) : NULL_TREE;\n- t = finish_id_expression (t, t, ctx, idk,\n+ t = finish_id_expression (t, t, NULL_TREE, idk,\n \t\t\t\t/*integral_constant_expression_p=*/false,\n \t\t\t\t/*allow_non_integral_constant_expr_p=*/true,\n \t\t\t\t&parser->non_integral_constant_expression_p,\n@@ -6414,11 +6404,11 @@ cp_parser_splice_expression (cp_parser *parser, bool template_p,\n \t\t\t\t/*done=*/true,\n \t\t\t\taddress_p,\n \t\t\t\ttemplate_arg_p,\n+\t\t\t\t/*splice_p=*/true,\n \t\t\t\t&error_msg,\n \t\t\t\tloc);\n if (error_msg)\n \tcp_parser_error (parser, error_msg);\n- pop_deferring_access_checks ();\n }\n \n return t;\n@@ -7174,6 +7164,7 @@ cp_parser_primary_expression (cp_parser *parser,\n \t\t &parser->non_integral_constant_expression_p,\n \t\t template_p, done, address_p,\n \t\t template_arg_p,\n+\t\t /*splice_p=*/false,\n \t\t &error_msg,\n \t\t id_expression.get_location ()));\n \tif (error_msg)\n@@ -13177,6 +13168,7 @@ cp_parser_lambda_introducer (cp_parser* parser, tree lambda_expr)\n /*done=*/true,\n /*address_p=*/false,\n /*template_arg_p=*/false,\n+\t\t /*splice_p=*/false,\n &error_msg,\n capture_token->location);\n \n@@ -19299,6 +19291,7 @@ cp_parser_decltype_expr (cp_parser *parser,\n /*done=*/true,\n /*address_p=*/false,\n /*template_arg_p=*/false,\n+\t\t /*splice_p=*/false,\n &error_msg,\n \t\t id_expr_start_token->location));\n \n@@ -53549,8 +53542,8 @@ cp_finish_omp_declare_variant (cp_parser *parser, cp_token *pragma_tok,\n \t= finish_id_expression (varid, variant, parser->scope,\n \t\t\t\t&idk, false, true,\n \t\t\t\t&parser->non_integral_constant_expression_p,\n-\t\t\t\ttemplate_p, true, false, false, &error_msg,\n-\t\t\t\tvarid.get_location ());\n+\t\t\t\ttemplate_p, true, false, false, false,\n+\t\t\t\t&error_msg, varid.get_location ());\n if (error_msg)\n \tcp_parser_error (parser, error_msg);\n }\ndiff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 7c6577b48ef..c510733d41b 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -21185,6 +21185,7 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \t\t\t\t /*done=*/true,\n \t\t\t\t /*address_p=*/false,\n \t\t\t\t /*template_arg_p=*/false,\n+\t\t\t\t /*splice_p=*/false,\n \t\t\t\t &error_msg,\n \t\t\t\t input_location);\n \tif (error_msg)\ndiff --git a/gcc/cp/semantics.cc b/gcc/cp/semantics.cc\nindex 236bc625c25..76b0ddb1b12 100644\n--- a/gcc/cp/semantics.cc\n+++ b/gcc/cp/semantics.cc\n@@ -4735,6 +4735,7 @@ process_outer_var_ref (tree decl, tsubst_flags_t complain, bool odr_use)\n TEMPLATE_P is true iff the qualified-id was of the form\n \"A::template B\". TEMPLATE_ARG_P is true iff this qualified name\n appears as a template argument.\n+ SPLICE_P is true if ID_EXPRESSION was designated by a splice-expression.\n \n If an error occurs, and it is the kind of error that might cause\n the parser to abort a tentative parse, *ERROR_MSG is filled in. It\n@@ -4760,6 +4761,7 @@ finish_id_expression_1 (tree id_expression,\n \t\t\tbool done,\n \t\t\tbool address_p,\n \t\t\tbool template_arg_p,\n+\t\t\tbool splice_p,\n \t\t\tconst char **error_msg,\n \t\t\tlocation_t location)\n {\n@@ -5022,16 +5024,23 @@ finish_id_expression_1 (tree id_expression,\n \t && contract_class_ptr == current_class_ptr)\n \t {\n \t error (\"%qD 'this' required when accessing a member within a \"\n-\t\t \"constructor precondition or destructor postcondition \"\n-\t\t \"contract check\", decl);\n-\t\t return error_mark_node;\n+\t\t \"constructor precondition or destructor postcondition \"\n+\t\t \"contract check\", decl);\n+\t return error_mark_node;\n \t }\n \t /* Since SCOPE is NULL here, this is an unqualified name.\n \t Access checking has been performed during name lookup\n \t already. Turn off checking to avoid duplicate errors. */\n \t push_deferring_access_checks (dk_no_check);\n-\t decl = finish_non_static_data_member (decl, NULL_TREE,\n-\t\t\t\t\t\t/*qualifying_scope=*/NULL_TREE);\n+\n+\t if (splice_p && address_p)\n+\t decl = build_offset_ref (DECL_CONTEXT (decl), decl,\n+\t\t\t\t /*address_p=*/true,\n+\t\t\t\t tf_warning_or_error);\n+\t else\n+\t decl\n+\t = finish_non_static_data_member (decl, NULL_TREE,\n+\t\t\t\t\t /*qualifying_scope=*/NULL_TREE);\n \t pop_deferring_access_checks ();\n \t}\n else if (is_overloaded_fn (decl))\n@@ -5041,6 +5050,11 @@ finish_id_expression_1 (tree id_expression,\n \t concerned with (all member fns or all non-members). */\n \t tree first_fn = get_first_fn (decl);\n \t first_fn = STRIP_TEMPLATE (first_fn);\n+\t tree ctx = DECL_CONTEXT (first_fn);\n+\n+\t if (splice_p && address_p)\n+\t return build_offset_ref (ctx, first_fn, /*address_p=*/true,\n+\t\t\t\t tf_warning_or_error);\n \n \t if (!template_arg_p\n \t && (TREE_CODE (first_fn) == USING_DECL\n@@ -5053,14 +5067,15 @@ finish_id_expression_1 (tree id_expression,\n \t\t && contract_class_ptr == current_class_ptr)\n \t\t{\n \t\t error (\"%qD 'this' required when accessing a member within a \"\n-\t\t \"constructor precondition or destructor postcondition \"\n-\t\t \"contract check\", decl);\n+\t\t\t \"constructor precondition or destructor postcondition \"\n+\t\t\t \"contract check\", decl);\n \t\t return error_mark_node;\n \t\t}\n-\t decl = maybe_dummy_object (DECL_CONTEXT (first_fn), 0);\n+\t decl = maybe_dummy_object (ctx, nullptr);\n \t return finish_class_member_access_expr (decl, id_expression,\n \t\t\t\t\t\t /*template_p=*/false,\n-\t\t\t\t\t\t tf_warning_or_error);\n+\t\t\t\t\t\t tf_warning_or_error,\n+\t\t\t\t\t\t splice_p);\n \t }\n \n \t decl = baselink_for_fns (decl);\n@@ -5080,7 +5095,8 @@ finish_id_expression_1 (tree id_expression,\n \n \t\t ??? Should this case make a clone instead, like\n \t\t handle_using_decl? */\n-\t\t gcc_assert (TREE_CODE (decl) == CONST_DECL);\n+\t\t gcc_assert (TREE_CODE (decl) == CONST_DECL\n+\t\t\t\t|| (splice_p && VAR_P (decl)));\n \t\t else\n \t\t perform_or_defer_access_check (TYPE_BINFO (path),\n \t\t\t\t\t\t decl, decl,\n@@ -5114,6 +5130,7 @@ finish_id_expression (tree id_expression,\n \t\t bool done,\n \t\t bool address_p,\n \t\t bool template_arg_p,\n+\t\t bool splice_p,\n \t\t const char **error_msg,\n \t\t location_t location)\n {\n@@ -5123,7 +5140,7 @@ finish_id_expression (tree id_expression,\n \t\t\t allow_non_integral_constant_expression_p,\n \t\t\t non_integral_constant_expression_p,\n \t\t\t template_p, done, address_p, template_arg_p,\n-\t\t\t error_msg, location);\n+\t\t\t splice_p, error_msg, location);\n return result.maybe_add_location_wrapper ();\n }\n \n@@ -6744,7 +6761,7 @@ omp_reduction_lookup (location_t loc, tree id, tree type, tree *baselinkp,\n \tdecl = error_mark_node;\n id = finish_id_expression (id, decl, NULL_TREE, &idk, false, true,\n \t\t\t\t &nonint_cst_expression_p, false, true, false,\n-\t\t\t\t false, &error_msg, loc);\n+\t\t\t\t false, false, &error_msg, loc);\n if (idk == CP_ID_KIND_UNQUALIFIED\n \t && identifier_p (id))\n \t{\n", "prefixes": [] }