{"id":2223143,"url":"http://patchwork.ozlabs.org/api/1.1/patches/2223143/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260414141710.99666-1-polacek@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/1.1/projects/17/?format=json","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},"msgid":"<20260414141710.99666-1-polacek@redhat.com>","date":"2026-04-14T14:17:10","name":"c++: introduce function_template_p","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"764aa8fc1ca0834f229955504a5b8da4def0a117","submitter":{"id":14370,"url":"http://patchwork.ozlabs.org/api/1.1/people/14370/?format=json","name":"Marek Polacek","email":"polacek@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260414141710.99666-1-polacek@redhat.com/mbox/","series":[{"id":499856,"url":"http://patchwork.ozlabs.org/api/1.1/series/499856/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=499856","date":"2026-04-14T14:17:10","name":"c++: introduce function_template_p","version":1,"mbox":"http://patchwork.ozlabs.org/series/499856/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2223143/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2223143/checks/","tags":{},"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=DjqKtDsG;\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=DjqKtDsG","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 4fw5wK0KQ8z1yDF\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 15 Apr 2026 00:18:09 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 36CF94BA23EB\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 14 Apr 2026 14:18: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 11F524BA23C3\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 14:17:22 +0000 (GMT)","from mx-prod-mc-05.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-630-YBf26FoVNIi0p5a5_gVVcw-1; Tue,\n 14 Apr 2026 10:17:20 -0400","from mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.111])\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-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 21AD2195608D\n for <gcc-patches@gcc.gnu.org>; Tue, 14 Apr 2026 14:17:19 +0000 (UTC)","from pdp-11.lan (unknown [10.22.65.99])\n by mx-prod-int-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 772C918002A6; Tue, 14 Apr 2026 14:17:18 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 36CF94BA23EB","OpenDKIM Filter v2.11.0 sourceware.org 11F524BA23C3"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 11F524BA23C3","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 11F524BA23C3","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776176242; cv=none;\n b=bjDHtWm58KLjC5wL2VzXd87WbK1yLTgac+mfPoeZM0O83nVUWmu0VwCdEEkHCTREt9l0H2hi2+w3hlE2e7M2vZL6gwYOfYK8P/aclXJSPmHZtIgvOMSOQiRE7irV+LpNk01F66LXViTuFSiKDK6A/M0ChONZIJCz4UpNYmTuSuk=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776176242; c=relaxed/simple;\n bh=rH/+twdLwI2k6Q/ajSTosE4scC4fL+FAGx/Wa6yLzjs=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=PBr5zSDLjZrBam5EvfB3jQ9fpRh63LyJdLH4VXlUaS2mNLhI91xcbgVvbOpxfcAodyGctFlGxQk0prA+vfdxS6m4jexvsRGecZJn3B5IAYzx6SEq+mgHBU884UOxm4defUuHxRCY27nLsAYOH7IWUErZ6kF/WSVEiFxio0gZpvY=","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=1776176241;\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=sgjv6WgCO9dm5n/Y53C0+tbCrumuC9ae3QhWGLsBBtQ=;\n b=DjqKtDsGO2pfsSD1j/P7GPluHSkRU3J7tdJqv0nIXiLqsmgfVZFt0bGTgUUCMutgGQxbqJ\n aCVBowseEuaT9VFg3ioxLnim2jZa2Js+i9UoCTz4qBxcDp15ScLIII3p1KmpSQ5sSsDMDg\n QdZtqReeV4riuMUMvT1yZ5oXPxzPLyc=","X-MC-Unique":"YBf26FoVNIi0p5a5_gVVcw-1","X-Mimecast-MFC-AGG-ID":"YBf26FoVNIi0p5a5_gVVcw_1776176239","From":"Marek Polacek <polacek@redhat.com>","To":"Jason Merrill <jason@redhat.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>","Subject":"[PATCH] c++: introduce function_template_p","Date":"Tue, 14 Apr 2026 10:17:10 -0400","Message-ID":"<20260414141710.99666-1-polacek@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.111","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"lCW3a0HqwfNoQJThmH11rk3gEdw2Lbp7rM0arJX2b3I_1776176239","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 --\nAs discussed in\n<https://gcc.gnu.org/pipermail/gcc-patches/2026-April/712156.html>,\nthis patch introduces a new predicate to be used instead of\nreally_overloaded_fn when we're checking for a function template.\n\ngcc/cp/ChangeLog:\n\n\t* cp-tree.h (function_template_p): Declare.\n\t* parser.cc (cp_parser_splice_expression): Use function_template_p\n\tinstead of really_overloaded_fn.\n\t* reflect.cc (check_splice_expr): Likewise.\n\t* tree.cc (function_template_p): New.\n---\n gcc/cp/cp-tree.h  | 1 +\n gcc/cp/parser.cc  | 2 +-\n gcc/cp/reflect.cc | 4 ++--\n gcc/cp/tree.cc    | 8 ++++++++\n 4 files changed, 12 insertions(+), 3 deletions(-)\n\n\nbase-commit: 31b012f7606ce7de82442e723ee62c05842c0f76","diff":"diff --git a/gcc/cp/cp-tree.h b/gcc/cp/cp-tree.h\nindex 1080203ac8a..e2466f195fa 100644\n--- a/gcc/cp/cp-tree.h\n+++ b/gcc/cp/cp-tree.h\n@@ -8722,6 +8722,7 @@ extern tree lookup_maybe_add\t\t\t(tree fns, tree lookup,\n \t\t\t\t\t\t bool deduping);\n extern int is_overloaded_fn\t\t\t(tree) ATTRIBUTE_PURE;\n extern bool really_overloaded_fn\t\t(tree) ATTRIBUTE_PURE;\n+extern bool function_template_p\t\t\t(tree) ATTRIBUTE_PURE;\n extern tree dependent_name\t\t\t(tree);\n extern tree call_expr_dependent_name\t\t(tree);\n extern tree maybe_get_fns\t\t\t(tree) ATTRIBUTE_PURE;\ndiff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex 9dbc2933e7b..53672b348c3 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -6341,7 +6341,7 @@ cp_parser_splice_expression (cp_parser *parser, bool template_p,\n       && (targs_p\n \t  /* No 'template' but the splice-specifier designates a function\n \t     template?  */\n-\t  || really_overloaded_fn (t))\n+\t  || function_template_p (t))\n       && warning_enabled_at (loc, OPT_Wmissing_template_keyword))\n     /* Were 'template' present, this would be valid code, so keep going.  */\n     missing_template_diag (loc, diagnostics::kind::pedwarn);\ndiff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc\nindex 4ef340f0726..91e4b9a364e 100644\n--- a/gcc/cp/reflect.cc\n+++ b/gcc/cp/reflect.cc\n@@ -8978,7 +8978,7 @@ check_splice_expr (location_t loc, location_t start_loc, tree t,\n \t template.  */\n       if (!targs_p)\n \t{\n-\t  if (!really_overloaded_fn (t) && !dependent_splice_p (t))\n+\t  if (!function_template_p (t) && !dependent_splice_p (t))\n \t    {\n \t      if (complain_p)\n \t\t{\n@@ -9005,7 +9005,7 @@ check_splice_expr (location_t loc, location_t start_loc, tree t,\n \t    }\n \t  return false;\n \t}\n-      gcc_checking_assert (really_overloaded_fn (t)\n+      gcc_checking_assert (function_template_p (t)\n \t\t\t   || get_template_info (t)\n \t\t\t   || TREE_CODE (t) == TEMPLATE_ID_EXPR\n \t\t\t   || variable_template_p (t)\ndiff --git a/gcc/cp/tree.cc b/gcc/cp/tree.cc\nindex 15dc8025f1b..48108027523 100644\n--- a/gcc/cp/tree.cc\n+++ b/gcc/cp/tree.cc\n@@ -2764,6 +2764,14 @@ really_overloaded_fn (tree x)\n   return is_overloaded_fn (x) == 2;\n }\n \n+/* Returns true iff X is a function template.  */\n+\n+bool\n+function_template_p (tree x)\n+{\n+  return really_overloaded_fn (x);\n+}\n+\n /* Get the overload set FROM refers to.  Returns NULL if it's not an\n    overload set.  */\n \n","prefixes":[]}