Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2221566/?format=api
{ "id": 2221566, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2221566/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260409201824.1440501-1-feedabl3@gmail.com/", "project": { "id": 17, "url": "http://patchwork.ozlabs.org/api/1.1/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 }, "msgid": "<20260409201824.1440501-1-feedabl3@gmail.com>", "date": "2026-04-09T20:17:14", "name": "[v2] c++/reflection: ICE on member function template splicing [PR124794]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "d0842c1aea0d93c4b49663bcf08600a33dc421a8", "submitter": { "id": 92146, "url": "http://patchwork.ozlabs.org/api/1.1/people/92146/?format=api", "name": "feedable", "email": "feedabl3@gmail.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/20260409201824.1440501-1-feedabl3@gmail.com/mbox/", "series": [ { "id": 499351, "url": "http://patchwork.ozlabs.org/api/1.1/series/499351/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=499351", "date": "2026-04-09T20:17:14", "name": "[v2] c++/reflection: ICE on member function template splicing [PR124794]", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/499351/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2221566/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2221566/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 (2048-bit key;\n unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=ZlS3cuqI;\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 unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256\n header.s=20251104 header.b=ZlS3cuqI", "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.221.52" ], "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 4fsB925H04z1xy1\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 06:19:02 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id E8CF84BA2E2E\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 9 Apr 2026 20:19:00 +0000 (GMT)", "from mail-wr1-f52.google.com (mail-wr1-f52.google.com\n [209.85.221.52])\n by sourceware.org (Postfix) with ESMTPS id 52B854BA2E10\n for <gcc-patches@gcc.gnu.org>; Thu, 9 Apr 2026 20:18:33 +0000 (GMT)", "by mail-wr1-f52.google.com with SMTP id\n ffacd0b85a97d-43cfd832155so804070f8f.1\n for <gcc-patches@gcc.gnu.org>; Thu, 09 Apr 2026 13:18:33 -0700 (PDT)", "from 7a38 ([2a02:8308:900b:fc00::1bf9])\n by smtp.gmail.com with ESMTPSA id\n ffacd0b85a97d-43d63e468d0sm1534658f8f.18.2026.04.09.13.18.31\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Thu, 09 Apr 2026 13:18:31 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org E8CF84BA2E2E", "OpenDKIM Filter v2.11.0 sourceware.org 52B854BA2E10" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 52B854BA2E10", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 52B854BA2E10", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775765913; cv=none;\n b=PZS28uujSJwViVV0tlu/qQVapgdfBIUnoyTZ6JHB3sFZo1UiLLx19F83oD+DFfXytfrNkyv+XwU7KjJuIMFMUL1SM7eEf4MWvxwutm1WS8E1CIj+xuzw2b6yjV/oNRs1Qp9mWISPIp6O33FofArGl826ZlbkkMfDB1xN1t3lbIQ=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775765913; c=relaxed/simple;\n bh=eFIbRV+2sLUohT2goYLi5PPpWLjwMpgtMbmUwvsnC8g=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=LV7ONWyBYPNzydrPEUerrJ+ZPmztKmfS7YZfiCFqJkTRXjllnzUDekSeIztwrsrjhFrIozM1hD05GNwjJMtqlHPKkCYijzLUDrGyXaKThFzxF9yEboMOLEOAhYHwr3O0xDhz7Mz3LMUxS/0Z4iyXkkUjUsF+OzPtlIL8rxSTLnk=", "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=1775765912; x=1776370712; darn=gcc.gnu.org;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:from:to:cc:subject:date:message-id:reply-to;\n bh=CCmF3baEwQUOKSuTe93PEVc0KxVpcrYFsMH+UfI7YSk=;\n b=ZlS3cuqIvC5B4ZmAojgIZ7v+mQKoTdP22O38bEQAs1GTy1yEQZaKVnm534gIsRu3gW\n B7rETmqBio1xv4DGvkpdT6bQruwsyoWHim0lhhvIBFE3xINGgTWfAo29Ihh5JPreSeHQ\n ZeC4l4sETtq6LhVMCCqtNdR/kjTPHsfF6i4qUAcnlufD1AXOu9rDd9EpJgtyCsm25OOl\n /L3svofI5H9u2PBw7XKrcrgduEbf2hHBCqJ1sAfHLY1BahNj/Cb9cyVovKaDpIecglfH\n y7TOXwui7ulSCPBYNqtFB6UjO2QAvjqDd/BvgsRA6yT5qZSIUjpu6CU1XHdNHhGHEA4V\n j/1w==", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775765912; x=1776370712;\n h=content-transfer-encoding:mime-version:message-id:date:subject:cc\n :to:from:x-gm-gg:x-gm-message-state:from:to:cc:subject:date\n :message-id:reply-to;\n bh=CCmF3baEwQUOKSuTe93PEVc0KxVpcrYFsMH+UfI7YSk=;\n b=ep//WEVsDpT3snPCCZuFndQEtpgLqUezaeKyjYQDKyeMyp9CCrVLzyt9mp9WfjmoTu\n s1DSeEbhEI/s2SrnAAMoO4ydX6FTTIRd/uuebzTYWH1glv+HKgb76X0WnWnbpk71zhIh\n ujfs2vF9IBLrMiXPN+QArqLQM4RuUBCaC75PtyoHCpA3nao9I0X6U3Knr8EQK++OZIwj\n POCa61ukWAIIVQDWQTkhY276Pqw+ou3gcazZe5LWKjBt43dQj9LxiH05Rt6p9IZYEtBD\n +XJ5OE35Esgsm7M1xxqHTvS1z4mso/62QyHVU/X9SjN53gf4jHnmi0kR3HRNrRqSnM4x\n pDIQ==", "X-Gm-Message-State": "AOJu0YwmzSOVC6h7wRD3chUw1xXMZ3IKKNikBYQ7mKwx0Ld6ctwDprWB\n AyNbEXgCZkuyFRorXnNjX0tPqRRSPTm3CsOsXm/6kA/9BgpuwI4qZNb8PtLhtA==", "X-Gm-Gg": "AeBDiesrd92yt8jtcv1+C0mIPUv4g0k8AWeI6tSMmCXL+wV/h1xfdOgXezcN1eQarsZ\n cHoOw0syeBQ42p13dnzCRcT21XRcbpVPS9DMRZkqSWKcNoO04GXDzOVSrMHP+jnn5sjW/PkJD9/\n mpZI+PDzSijQwDkojMSSNTeAOCzFicIOoVpOJw0G9m2pg5op/LnZ76D/a0h06+gJAKgcMzC+mhA\n KCq107QpOK3apNXfQdTZfv7OKBf95NSuT8Km4wQVBt2NWPE4O5Z/zTd68krm4g5W5nububG1fP2\n FcCvwGnrg4adqEufYhMbtGdU8BqzfCRFYwle9Bo8fIy7bUsYli8CJ0HHFzMy7wYxq4/HVK4jxv1\n g8pQqOuZyf6Il6ycFVrGEh0FIRK3SCJsVGPzxMvK91LfGosH1NDc2w0CgbVtPWuJP19UZr5NTog\n ==", "X-Received": "by 2002:a5d:5849:0:b0:43b:45a0:9df8 with SMTP id\n ffacd0b85a97d-43d642be552mr591249f8f.35.1775765911845;\n Thu, 09 Apr 2026 13:18:31 -0700 (PDT)", "From": "feedable <feedabl3@gmail.com>", "To": "gcc-patches@gcc.gnu.org", "Cc": "feedable <feedabl3@gmail.com>", "Subject": "[PATCH v2] c++/reflection: ICE on member function template splicing\n [PR124794]", "Date": "Thu, 9 Apr 2026 23:17:14 +0300", "Message-ID": "<20260409201824.1440501-1-feedabl3@gmail.com>", "X-Mailer": "git-send-email 2.53.0", "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": "cp_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.\nStrip BASELINKs for the purposes of checking and grab the data from the\nreflection for actual use.\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\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/splice12.C: New test.\n---\n gcc/cp/parser.cc | 24 +++++++++--------\n gcc/testsuite/g++.dg/reflect/splice12.C | 34 +++++++++++++++++++++++++\n 2 files changed, 48 insertions(+), 10 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/splice12.C", "diff": "diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex fe27a15a283..ea89847116d 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 && DECL_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, BASELINK_BINFO (expr),\n+\t\t\t\t\tBASELINK_FUNCTIONS (expr),\n+\t\t\t\t\tBASELINK_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@@ -6310,7 +6315,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@@ -6331,8 +6335,8 @@ cp_parser_splice_expression (cp_parser *parser, bool template_p,\n }\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+ if (!check_splice_expr (loc, expr.get_start (), MAYBE_BASELINK_FUNCTIONS (t),\n+ address_p, member_access_p, template_p, targs_p,\n \t\t\t /*complain=*/true))\n return error_mark_node;\n \ndiff --git a/gcc/testsuite/g++.dg/reflect/splice12.C b/gcc/testsuite/g++.dg/reflect/splice12.C\nnew file mode 100644\nindex 00000000000..bdce1da2efa\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/splice12.C\n@@ -0,0 +1,34 @@\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+void (C::*p1)(int) = &template[:^^C::f:];\n+void (C::*p2)(int) = &[:^^C::f:]; // { dg-warning \"keyword before dependent template name\" }\n+void (C::*p3)(int) = &template[:^^C::f:]<int>;\n+void (C::*p4)(int) = &[:^^C::f:]<int>; // { dg-warning \"keyword before dependent template name\" }\n+auto p5 = &template[:^^C::f:]<int>;\n+auto p6 = &[:^^C::f:]<int>; // { dg-warning \"keyword before dependent template name\" }\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:](13)==13); // { 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:](13)==13); // { dg-warning \"keyword before dependent template name\" }\n+static_assert(Base3{}.[:^^Base2::g:]<int>(13)==13); // { 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": [ "v2" ] }