Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2225885/?format=api
{ "id": 2225885, "url": "http://patchwork.ozlabs.org/api/patches/2225885/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260421182406.362784-2-feedabl3@gmail.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": "<20260421182406.362784-2-feedabl3@gmail.com>", "list_archive_url": null, "date": "2026-04-21T18:23:29", "name": "[v3] c++/reflection: ICE on member function template splicing [PR124794]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "4ac4d436e888e270dbb7bc0ac9f48622fc582f68", "submitter": { "id": 92146, "url": "http://patchwork.ozlabs.org/api/people/92146/?format=api", "name": "feedable", "email": "feedabl3@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260421182406.362784-2-feedabl3@gmail.com/mbox/", "series": [ { "id": 500866, "url": "http://patchwork.ozlabs.org/api/series/500866/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500866", "date": "2026-04-21T18:23:29", "name": "[v3] c++/reflection: ICE on member function template splicing [PR124794]", "version": 3, "mbox": "http://patchwork.ozlabs.org/series/500866/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225885/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225885/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 unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=KIidP73a;\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 unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=KIidP73a", "sourceware.org;\n dmarc=pass (p=none dis=none) header.from=gmail.com", "sourceware.org; spf=pass smtp.mailfrom=gmail.com", "server2.sourceware.org;\n arc=none smtp.remote-ip=209.85.128.49" ], "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 4g0W9127hCz1yHB\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 04:29:23 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id B7A4F4BA9000\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 18:29:21 +0000 (GMT)", "from mail-wm1-f49.google.com (mail-wm1-f49.google.com\n [209.85.128.49])\n by sourceware.org (Postfix) with ESMTPS id 2B7484BA23F3\n for <gcc-patches@gcc.gnu.org>; Tue, 21 Apr 2026 18:28:53 +0000 (GMT)", "by mail-wm1-f49.google.com with SMTP id\n 5b1f17b1804b1-4893940bb5eso14621025e9.3\n for <gcc-patches@gcc.gnu.org>; Tue, 21 Apr 2026 11:28:53 -0700 (PDT)", "from 7a38 ([2a02:8308:900b:fc00::2690])\n by smtp.gmail.com with ESMTPSA id\n 5b1f17b1804b1-488fb735d3dsm260352285e9.2.2026.04.21.11.28.50\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Tue, 21 Apr 2026 11:28:51 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org B7A4F4BA9000", "OpenDKIM Filter v2.11.0 sourceware.org 2B7484BA23F3" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 2B7484BA23F3", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 2B7484BA23F3", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776796133; cv=none;\n b=BziaMr4JyOFf1XCRNL+4k/wzRu3dzc1ghkxxuH9yeeAQCkDTOR5yOyD2TS2VG2H95nAL6Udm4yYyIZA4RDwHbivPagyuz932WMbYy9SF7MSgCkI6SMwFDIKsIVrpDSqg48sGY27zp/76cwyXcOdrNReInlHI+DVHt9dK0FlTWfU=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776796133; c=relaxed/simple;\n bh=nlZXejjKneIDSxewkQWlNjFgJyqKN8kZyF5kjqasyyM=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=AotGk/NKjg/0GD2A7jxlURC8iWfLd/b8ZvETIfTqBE1ZPpWFJOimIa9XWPGrOMEsdSm5fHOp7QM2eEVTOR4n1/vi33c0vBfI27C1sdpXn9IWWH9GHp6cUNNCsyMIn54Ni7HmzLn9X+sNIYV7GaSJ5b39Bt8x6fHyU90b/7yDg+c=", "ARC-Authentication-Results": "i=1; server2.sourceware.org", "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=gmail.com; s=20251104; t=1776796132; x=1777400932; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:from:to:cc:subject:date\n :message-id:reply-to;\n bh=z4wTZv+pru6vQRnBgucFjT9KeN1/92m5gusjKNIi0nw=;\n b=KIidP73aWLiXY0y4EU0DhtaBa9vSbayJxstKO7rVSk3WkIOoYI/WbII0HKt5yyZ6St\n pCnoQCJ0nVoaMle48+2laIS5iCrt8dL/FPhoDsr0Uy3eZEVe42icGqyPkAw1DopU5qTS\n YJkHTlnWu4xW/XZsDSUnh8i0f321JsVho/PBQn4rNRSHT/x+ygu3SMHxn2B6SJPI2Jha\n qw7IBt2uxjb5tJg9OoOpcap6U044F33GOZ5pAe+VGkxLxVjr0qF66twLsUUUIa0g4a5h\n qMWqcaoTTrSaFREmec8UsfwjEmMdPTeCDTnMIq8zqgs6hhh+z7qnswRmfA0HE/EBQAu5\n dZCg==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776796132; x=1777400932;\n h=content-transfer-encoding:mime-version:references:in-reply-to\n :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=z4wTZv+pru6vQRnBgucFjT9KeN1/92m5gusjKNIi0nw=;\n b=h1TpllQJBkTrHtFii4n26Z9+8YxE3eiMlpPk89TE/imGV0IgVb3FUAm35A9lFTJB2k\n poAuv6ITGRRpebynWbqa+qCPN6s2sHoS2LzdlUF7hDQkQ63cqReuexCE6bj4vtFyUgIS\n H/o/CbHty/HRZVB5L+pCJJFrQklJjaRyd6vM4GoGbI1bmLsWfdWQoEIUThrfNJDPxAfT\n oCJEWmnZHjBYL7xHuqLq37YhT1R7nfvqziFmXeF1xUN4QrEjYhgR3XlOHva53wbryahc\n LAqbAcc0MWz2oxLwwmPrDa9LFWnhAqG3/S34RVwZzm3XrARymufIz3BiNmD6abOBMC7D\n oZeQ==", "X-Gm-Message-State": "AOJu0YyhnPJnfoIPb6w/6BQ6Gs5O8LBtKR3HEBdZIRkbUx0FUb0+btQm\n +OAxIuw38Px61+ij2cAOXhTmq9hfNLtGhotk7gIzlAGMMKLK+fSY/3PngXz3XA==", "X-Gm-Gg": "AeBDievq0P1uT9LlJVFa5DLP03ZPI5f2fXugymHHzZvT5Zi6IGP+u0fkLNbjGNq47ds\n tZU68M/LFCtKV+eyHXrS1R9razwVks/Ip7Fn/jPo+WFSyT2yxvWNp+hmgj11DacF7Qq4uMj06M4\n g1Oq/o1TVP5D+TmoIM4MWLVXhNaVXDrzwunScXXghlkQZhSz7tAHDCglKRZwvjAMFCmUYtytU5P\n hBo9Kpu+pwRpNbbeTtk6wxhqUZv9LPUtXEYZ/rzNcSKHq/wY3wfkq+ZdxQ8QJ2y6JLULGZUR6x1\n l8XrM5HK3wkrStuN86Y7VD62OXH1qBAQBYZwz/V+MTA2oFe9+2sPy3vlYf6N0g5aFlqRX/NJuuk\n Yh+rSm4KRmWlwQNdFHaRXJNtkeXTaJ+1ObbbnlzN7wLckVVUS6iTwsI6KLI+P2IO/Z3l6GjMjwV\n 3GSQKu+fAYe3kSOgWDMEI=", "X-Received": "by 2002:a05:600c:a416:b0:483:8062:b2f with SMTP id\n 5b1f17b1804b1-488fb73b31dmr231999065e9.6.1776796131645;\n Tue, 21 Apr 2026 11:28:51 -0700 (PDT)", "From": "feedable <feedabl3@gmail.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "Jason Merrill <jason@redhat.com>, Marek Polacek <polacek@redhat.com>,\n feedable <feedabl3@gmail.com>", "Subject": "[PATCH v3] c++/reflection: ICE on member function template splicing\n [PR124794]", "Date": "Tue, 21 Apr 2026 21:23:29 +0300", "Message-ID": "<20260421182406.362784-2-feedabl3@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "In-Reply-To": "<82c59580-b3a7-46b8-b2ed-e47ad70289ef@redhat.com>", "References": "<82c59580-b3a7-46b8-b2ed-e47ad70289ef@redhat.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "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": ">>>> gcc/testsuite/ChangeLog:\n>>>>\n>>>> * g++.dg/reflect/splice12.C: New test.\n>>\n>> Note that this test will have to be renamed to splice13.C.\n>>\n\nDone\n\n>>>> + else if (BASELINK_P (expr))\n>>>> + expr = build_baselink (access_path, BASELINK_BINFO (expr),\n>>\n>> Extra space before =. Also I guess BASELINK_ACCESS_BINFO instead of\n>> BASELINK_BINFO?\n>\n> We want to use access_path (relative to the actual object_type) in place of \n> BASELINK_ACCESS_BINFO, but indeed the access path should be the second \n> argument rather than the first in both this call and the existing one. \n\nIf I understand correctly, access_path is the endpoint of the search, so it \nshould go into BASELINK_BINFO, and it's the object type that should go\ninto BASELINK_ACCESS_BINFO (in both cases, actually), since it's the\nplace where we started the search.\n\n>>>> - member_access_p, template_p, targs_p,\n>>>> + if (!check_splice_expr (loc, expr.get_start (), MAYBE_BASELINK_FUNCTIONS \n>>>> (t),\n>>>\n>>> I think it's probably preferable for check_splice_expr to handle getting a\n>>> BASELINK, since tsubst_splice_expr. Marek, thoughts?\n>>\n>> I think that's better. It looks like we'll need MAYBE_BASELINK_FUNCTIONS\n>> before the gcc_checking_assert at the end of check_splice_expr for the\n>> get_template_info check.\n>>\n>> Marek\n>>\n>\n\nAfter an attempt to test check_splice_expr in a templated context, I\nuncovered another bug in tsubst_expr, which I also fixed now. Also\nupdated the test to check all splice expr permutations\n\n-- >8 --\n\ncp_parser_splice_expression is stripping BASELINKs before resolving the expr;\nchecks if the result is a BASELINK after that (by which point it never is).\nTo fix it, we strip the BASELINK only after resolving and only for checks\n(where applicable).\n\nIn cp_parser_splice_specifier, the additional template param parsing fails to\ndetect that the reflection is a template if it's wrapped in a BASELINKs, and\ndecides not to parse the splice-specialization-specifier if the 'template'\nkeyword is missing. Grab the data from the reflection instead.\n\nDuring dependent parsing, the address-of part of a splice-specifier is\nunfortunately not emited initially, but rather recorded into the splice-expr\nitself. That means that after substitution of the splice-expr, the order of\napplication is wrong (i.e. the OFFSET_REF is placed within TEMPLATE_ID_EXPR).\nTo rectify that, reorder nodes and recur.\n\n\tPR c++/124794\n\ngcc/cp/ChangeLog:\n\n\t* parser.cc (cp_parser_splice_specifier): Do not strip BASELINKs\n\t(cp_parser_splice_expression): Add parsing for member function template\n\tspecializations without the \"template\" keyword\n\t* pt.cc (tsubst_expr): Handle OFFSET_REFs in the template part of\n\tTEMPLATE_ID_EXPR\n\t* reflect.cc (check_splice_expr): Add handling for BASELINKs\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/splice13.C: New test.\n---\n gcc/cp/parser.cc | 22 +++++-----\n gcc/cp/pt.cc | 18 +++++++++\n gcc/cp/reflect.cc | 10 ++---\n gcc/testsuite/g++.dg/reflect/splice13.C | 54 +++++++++++++++++++++++++\n 4 files changed, 90 insertions(+), 14 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/splice13.C", "diff": "diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 9f2641f2ab2..8becef7022f 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -6179,6 +6179,8 @@ cp_parser_splice_specifier (cp_parser *parser, bool template_p = false,\n /* Get the reflected operand. */\n expr = splice (expr);\n \n+ tree expr_real = maybe_get_first_fn (expr);\n+\n /* If the next token is a <, it could be a splice-specialization-specifier.\n But we need to handle \"[:r:] < 42\" where the < doesn't start a template\n argument list. [temp.names]/3: A < is interpreted as the delimiter of\n@@ -6190,30 +6192,33 @@ cp_parser_splice_specifier (cp_parser *parser, bool template_p = false,\n /* As a courtesy to the user, if there is a < after a template\n \t name, parse the construct as an s-s-s and warn about the missing\n \t 'template'; it can't be anything else. */\n- && (template_p\n-\t || typename_p\n-\t || TREE_CODE (OVL_FIRST (expr)) == TEMPLATE_DECL))\n+ && (template_p || typename_p || TREE_CODE (expr_real) == TEMPLATE_DECL))\n {\n /* For member access splice-specialization-specifier, try to wrap\n \t non-dependent splice for function template into a BASELINK so\n \t that cp_parser_template_id can handle it. */\n if (object_type\n-\t && DECL_FUNCTION_TEMPLATE_P (OVL_FIRST (expr))\n+\t && reflection_function_template_p (expr_real)\n \t && !dependent_type_p (object_type))\n \t{\n-\t tree scope = DECL_CONTEXT (OVL_FIRST (expr));\n+\t tree scope = DECL_CONTEXT (expr_real);\n \t if (scope && CLASS_TYPE_P (scope))\n \t {\n \t tree access_path = lookup_base (object_type, scope, ba_unique,\n \t\t\t\t\t NULL, tf_warning_or_error);\n \t if (access_path == error_mark_node)\n \t\texpr = error_mark_node;\n+\t else if (BASELINK_P (expr))\n+\t\texpr = build_baselink (access_path, TYPE_BINFO (object_type),\n+\t\t BASELINK_FUNCTIONS (expr),\n+\t\t BASELINK_OPTYPE (expr));\n \t else\n \t\texpr\n \t\t = build_baselink (access_path, TYPE_BINFO (object_type),\n \t\t\t\t expr,\n-\t\t\t\t IDENTIFIER_CONV_OP_P (OVL_NAME (expr))\n-\t\t\t\t ? TREE_TYPE (OVL_NAME (expr)) : NULL_TREE);\n+\t\t\t\t IDENTIFIER_CONV_OP_P (OVL_NAME (expr_real))\n+\t\t\t\t ? TREE_TYPE (OVL_NAME (expr_real))\n+\t\t\t\t : NULL_TREE);\n \t }\n \t}\n /* Let cp_parser_template_id parse the template arguments. */\n@@ -6316,7 +6321,6 @@ cp_parser_splice_expression (cp_parser *parser, bool template_p,\n tree t = expr.get_value ();\n STRIP_ANY_LOCATION_WRAPPER (t);\n tree unresolved = t;\n- t = MAYBE_BASELINK_FUNCTIONS (t);\n t = resolve_nondeduced_context (t, tf_warning_or_error);\n \n if (dependent_splice_p (t))\n@@ -6338,7 +6342,7 @@ cp_parser_splice_expression (cp_parser *parser, bool template_p,\n \n /* Make sure this splice-expression produces an expression. */\n if (!check_splice_expr (loc, expr.get_start (), t, address_p,\n-\t\t\t member_access_p, template_p, targs_p,\n+ member_access_p, template_p, targs_p,\n \t\t\t /*complain=*/true))\n return error_mark_node;\n \ndiff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 2cf14e2c801..e6c2e2cd9a6 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -21455,6 +21455,24 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \telse\n \t templ = tsubst_expr (templ, args, complain, in_decl);\n \n+\t/* ??? tsubst_splice_expr may throw us for a loop and return an\n+\t address-of of the template decl instead of a plain template decl.\n+\t Substitute the template-id first, and the address-of expr after\n+\t that to get back on track.\n+\t The proper solution here is to emit the OFFSET_REF during parsing,\n+\t and get a clean template node from tsubst_splice_expr. However,\n+\t OFFSET_REF expr requires a type to build, which we wouldn't know\n+\t until the splice is performed. */\n+\tif (TREE_CODE (templ) == OFFSET_REF)\n+\t {\n+\t tree addr = copy_node (templ);\n+\t tree &fns = TREE_OPERAND (addr, 1);\n+\t tree idexpr_real = copy_node (t);\n+\t TREE_OPERAND (idexpr_real, 0) = fns;\n+\t fns = tsubst_expr (idexpr_real, args, complain, in_decl);\n+\t RETURN (tsubst_expr (addr, args, complain, in_decl));\n+\t }\n+\n \tif (targs)\n \t targs = tsubst_template_args (targs, args, complain, in_decl);\n \tif (targs == error_mark_node)\ndiff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc\nindex b36c4be4273..16da146afbe 100644\n--- a/gcc/cp/reflect.cc\n+++ b/gcc/cp/reflect.cc\n@@ -9018,12 +9018,12 @@ check_splice_expr (location_t loc, location_t start_loc, tree t,\n foo.[: ^^S::bar :]. */\n if (!address_p\n && !member_access_p\n- && DECL_P (t)\n- && DECL_NONSTATIC_MEMBER_P (t))\n+ && DECL_P (maybe_get_first_fn (t))\n+ && DECL_NONSTATIC_MEMBER_P (maybe_get_first_fn (t)))\n {\n if (complain_p)\n \terror_at (loc, \"cannot implicitly reference a class member %qD \"\n-\t\t \"through a splice\", t);\n+\t\t \"through a splice\", maybe_get_first_fn (t));\n return false;\n }\n \n@@ -9113,7 +9113,7 @@ check_splice_expr (location_t loc, location_t start_loc, tree t,\n \t\t auto_diagnostic_group d;\n \t\t error_at (loc, \"expected a reflection of a function \"\n \t\t\t \"template\");\n-\t\t inform_tree_category (t);\n+\t\t inform_tree_category (maybe_get_first_fn (t));\n \t\t}\n \t return false;\n \t }\n@@ -9134,7 +9134,7 @@ check_splice_expr (location_t loc, location_t start_loc, tree t,\n \t return false;\n \t}\n gcc_checking_assert (reflection_function_template_p (t)\n-\t\t\t || get_template_info (t)\n+\t\t\t || get_template_info (MAYBE_BASELINK_FUNCTIONS (t))\n \t\t\t || TREE_CODE (t) == TEMPLATE_ID_EXPR\n \t\t\t || variable_template_p (t)\n \t\t\t || dependent_splice_p (t));\ndiff --git a/gcc/testsuite/g++.dg/reflect/splice13.C b/gcc/testsuite/g++.dg/reflect/splice13.C\nnew file mode 100644\nindex 00000000000..f432b50f812\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/splice13.C\n@@ -0,0 +1,54 @@\n+// PR c++/124794\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection -Wno-error=missing-template-keyword\" }\n+\n+struct C { template <class T> void f(T); };\n+\n+void (C::*p0)(int) = &template[:^^C::f:]<int>;\n+void (C::*p1)(int) = template[:^^C::f:]<int>; // { dg-error \"cannot implicitly reference a class member\" }\n+void (C::*p2)(int) = &template[:^^C::f:];\n+void (C::*p3)(int) = template[:^^C::f:]; // { dg-error \"cannot implicitly reference a class member\" }\n+void (C::*p4)(int) = &[:^^C::f:]<int>; // { dg-warning \"keyword before dependent template name\" }\n+void (C::*p5)(int) = [:^^C::f:]<int>; // { dg-error \"cannot implicitly reference a class member\" }\n+void (C::*p6)(int) = &[:^^C::f:]; // { dg-warning \"keyword before dependent template name\" }\n+void (C::*p7)(int) = [:^^C::f:]; // { dg-error \"cannot implicitly reference a class member\" }\n+\n+template <auto r> void (C::*tp0)(int) = &template[:r:]<int>;\n+template <auto r> void (C::*tp1)(int) = template[:r:]<int>; // { dg-error \"cannot implicitly reference a class member\" }\n+template <auto r> void (C::*tp2)(int) = &template[:r:];\n+template <auto r> void (C::*tp3)(int) = template[:r:]; // { dg-error \"cannot implicitly reference a class member\" }\n+/* tp4 and tp5 intentionally omitted as they are not applicable in a template context */\n+template <auto r> void (C::*tp6)(int) = &[:r:];\n+template <auto r> void (C::*tp7)(int) = [:r:]; // { dg-error \"cannot implicitly reference a class member\" }\n+\n+static_assert((\n+ tp0<^^C::f>,\n+ tp1<^^C::f>,\n+ tp2<^^C::f>,\n+ tp3<^^C::f>,\n+ tp6<^^C::f>,\n+ tp7<^^C::f>,\n+ true));\n+\n+struct Base1{\n+ template<class T>\n+ constexpr T f(T x) {\n+ return x;\n+ }\n+};\n+struct Base2: Base1 {\n+ template<class T>\n+ constexpr T g(T x) {\n+ return x;\n+ }\n+};\n+struct Base3: Base1, Base2 {}; // { dg-warning \"inaccessible\" }\n+\n+static_assert(Base1{}.[:^^Base1::f:](4) == 4); // { dg-warning \"keyword before dependent template name\" }\n+static_assert(Base1{}.[:^^Base1::f:]<int>(13) == 13); // { dg-warning \"keyword before dependent template name\" }\n+static_assert(Base3{}.[:^^Base2::g:](42) == 42); // { dg-warning \"keyword before dependent template name\" }\n+static_assert(Base3{}.[:^^Base2::g:]<int>(67) == 67); // { dg-warning \"keyword before dependent template name\" }\n+constexpr int invalid1 = Base3{}.[:^^Base2::f:]; // { dg-error \"cannot resolve overloaded function\" }\n+// { dg-warning \"keyword before dependent template name\" \"\" { target *-*-* } .-1 }\n+constexpr int invalid2 = Base3{}.[:^^Base1::f:]; // { dg-error \"cannot resolve overloaded function\" }\n+// { dg-warning \"keyword before dependent template name\" \"\" { target *-*-* } .-1 }\n", "prefixes": [ "v3" ] }