Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/1.1/patches/2225183/?format=api
{ "id": 2225183, "url": "http://patchwork.ozlabs.org/api/1.1/patches/2225183/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/aeY9k589Zfb7zboB@redhat.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": "<aeY9k589Zfb7zboB@redhat.com>", "date": "2026-04-20T14:52:03", "name": "[v2] c++/reflection: support splices with CTAD [PR124706]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "dc1ff576e170a01c97a1c59680a46a56cba65286", "submitter": { "id": 14370, "url": "http://patchwork.ozlabs.org/api/1.1/people/14370/?format=api", "name": "Marek Polacek", "email": "polacek@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/gcc/patch/aeY9k589Zfb7zboB@redhat.com/mbox/", "series": [ { "id": 500616, "url": "http://patchwork.ozlabs.org/api/1.1/series/500616/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=500616", "date": "2026-04-20T14:52:03", "name": "[v2] c++/reflection: support splices with CTAD [PR124706]", "version": 2, "mbox": "http://patchwork.ozlabs.org/series/500616/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2225183/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2225183/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=KvVhcs4Z;\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=KvVhcs4Z", "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 4fzpPm1pnrz1yGs\n\tfor <incoming@patchwork.ozlabs.org>; Tue, 21 Apr 2026 00:52:58 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id D78694D108F4\n\tfor <incoming@patchwork.ozlabs.org>; Mon, 20 Apr 2026 14:52:56 +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 617654D108D8\n for <gcc-patches@gcc.gnu.org>; Mon, 20 Apr 2026 14:52:11 +0000 (GMT)", "from mail-qk1-f200.google.com (mail-qk1-f200.google.com\n [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-466-hCdRHpyCMVWKzGwS69fzWA-1; Mon, 20 Apr 2026 10:52:09 -0400", "by mail-qk1-f200.google.com with SMTP id\n af79cd13be357-8cd722c1a69so540847385a.0\n for <gcc-patches@gcc.gnu.org>; Mon, 20 Apr 2026 07:52:08 -0700 (PDT)", "from redhat.com ([2603:7000:9500:10::1db4])\n by smtp.gmail.com with ESMTPSA id\n af79cd13be357-8ecb003e4dasm102420785a.38.2026.04.20.07.52.05\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Mon, 20 Apr 2026 07:52:06 -0700 (PDT)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org D78694D108F4", "OpenDKIM Filter v2.11.0 sourceware.org 617654D108D8" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org 617654D108D8", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org 617654D108D8", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776696731; cv=none;\n b=nZnnDc6K00oiebvPeojgHhRrn1mLhigci9iYsaAWq2xL+GjpLLihnKqCA7o5klefDj+IvhzU/gYuyShAGzFhsGKzsxaM8Rub1lBQisnYZoYbQHZJKnWs4H3ajftqLBLMhtRsqlQdrad79+kRKqtOCRbFlWI1fqEJADOw9P8NWKo=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776696731; c=relaxed/simple;\n bh=wJm5jZCmUHKp+YjaXACXJRBDgRJgodzJKONzYPvshX8=;\n h=DKIM-Signature:Date:From:To:Subject:Message-ID:MIME-Version;\n b=RtyT+F4XkosRAiC4AvC+e0ibD0nA9wOr7NG2Oc8vSwy/qEKEReMt7J4F2Ebr3f1XtdXSHYrtoE86Ek7M9Rj23c5oqL8cHINQEvLXSEGrcbulH/AdiFAVLTEzQYW4BmLteKr4nfUOOze/ikSDFgXo0xMK5wovSuUlyd6vi+PFBBs=", "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=1776696730;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:content-type:content-type:\n in-reply-to:in-reply-to:references:references;\n bh=9OXqGTn41/rh9HoyL7/yNitdavlERMifiWbkKy2ZRjA=;\n b=KvVhcs4Ziut5CRiB8ZmXZ59Nfv9B0q18DBuEZinfH+qz43SXxe8z3Id5ftB6wfaewgUh7/\n pCo2JI0TBekoGf2VIqPVM3fPLXn6Uc9J8sVdPVSwqo0D86s3we1xQ25GN1KaelvTewRgmK\n c/+2y/RAHKSak1Srzc50zo8tzXZp0Ys=", "X-MC-Unique": "hCdRHpyCMVWKzGwS69fzWA-1", "X-Mimecast-MFC-AGG-ID": "hCdRHpyCMVWKzGwS69fzWA_1776696728", "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776696727; x=1777301527;\n h=user-agent:in-reply-to:content-disposition:mime-version:references\n :message-id:subject:cc:to:from:date:x-gm-gg:x-gm-message-state:from\n :to:cc:subject:date:message-id:reply-to;\n bh=9OXqGTn41/rh9HoyL7/yNitdavlERMifiWbkKy2ZRjA=;\n b=RqKeiEtlAeYnvKHminI651SLCGbOb2UXtEYvQ4YUNw7H2NzKmlTVHuScEtbIDj2BeP\n 2TVi5NWhDz0NylwM43NWoVgfsGkTaBWSTYvHHew1daJby/jO16HqTJN79HdJGh7RSnJq\n ykzjdgq9ZnqK9URyJCgbBdyhYUw5Q+OX3A1j3cp2qB+90E/sAvrW9eV772dP5YPqci74\n 1wP2EejHcPisqN69SZRvZXicwPjSEhBP2JM02x9CX1ODu1IJvJAEoa+YZ8QPmi3rNRps\n 1fzrQnDqBzKRFAu8uFJ7wxs3+K5uGRVIx59gVKqbB5B+hSau/N3ca53lei53YEz+1NTu\n sgVg==", "X-Gm-Message-State": "AOJu0YwnRP6zdxJ8XhzISyQSUymNW4Ah8L0LW7nfmCkDpBb61DE7ESPT\n sb/Rwg3cWqyFGfqhpIcaGi+WbotyiQp4mKjRuYm6VXbDdh6QLlH7KCfqV6eyqC/ThS/Q8A+37Tj\n 1d9PYWsryFp+ugtUv7tJ0bHF7YDjZdtFtVpqN5m7w6K10spaH7tUk6yG/JflTz4jCqv0=", "X-Gm-Gg": "AeBDieu7NVEg7shOG08drTYCJJrUUso9neHmEMzFsxDj3JHvGQ6p1rnCUYRNhAJ/sj/\n TkysBnW+wo6OAO10nb3Oe5dALjCDjZ6j+fN4yIkyxPoWZP4TUsR/KE7A8KUPNjRTg044MwE6CsN\n 9vTTRXjUojhNcCblByxXiXzo1mBTyg7NGCW1auMyrElo193FEy80+EYJKkJ+rr1zCH9wgNpEyUL\n KxMrUZyFe7zm/2Ia25zrs06COpq2J5ynizSVA8tr4NFKZZ2bhwen3hQwiyOQnPyFpckFa37qz2w\n xWX6uVxRkpyDwtCRdKJvMyI2loWmmOfri2MQyJ9HFXsWYaRsQABosC7EhFmDC0GXDbuZQj2IBmO\n 5CV3LrpDlBlJn", "X-Received": [ "by 2002:a05:620a:4489:b0:8cf:def2:c36d with SMTP id\n af79cd13be357-8e7918a347emr1969666685a.30.1776696727411;\n Mon, 20 Apr 2026 07:52:07 -0700 (PDT)", "by 2002:a05:620a:4489:b0:8cf:def2:c36d with SMTP id\n af79cd13be357-8e7918a347emr1969662085a.30.1776696726908;\n Mon, 20 Apr 2026 07:52:06 -0700 (PDT)" ], "Date": "Mon, 20 Apr 2026 10:52:03 -0400", "From": "Marek Polacek <polacek@redhat.com>", "To": "Jason Merrill <jason@redhat.com>", "Cc": "GCC Patches <gcc-patches@gcc.gnu.org>", "Subject": "[PATCH v2] c++/reflection: support splices with CTAD [PR124706]", "Message-ID": "<aeY9k589Zfb7zboB@redhat.com>", "References": "<20260417202807.373863-1-polacek@redhat.com>\n <18c81c0b-da77-4423-960f-3c5e88bf336b@redhat.com>", "MIME-Version": "1.0", "In-Reply-To": "<18c81c0b-da77-4423-960f-3c5e88bf336b@redhat.com>", "User-Agent": "Mutt/2.3.1 (2026-03-20)", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "FAZkQ1lGWV2tfxODAtJOF-BhY3rcYCDoFDHXGI2DUDs_1776696728", "X-Mimecast-Originator": "redhat.com", "Content-Type": "text/plain; charset=us-ascii", "Content-Disposition": "inline", "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 Fri, Apr 17, 2026 at 05:57:42PM -0400, Jason Merrill wrote:\n> On 4/17/26 4:28 PM, Marek Polacek wrote:\n> > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?\n> \n> OK.\n\nI realized I'd forgotten to update tsubst_splice_scope so CTAD\nstill didn't work with dependent splices. I'd like to push this\npatch instead.\n\nWe should also improve the \"is not usable in a splice\" messages\nbut that's for a follow up patch.\n\nTest reflect/*, ok for trunk?\n\n-- >8 --\nThis PR points out that we don't handle a splice-type-spec that\ndesignates a deducible template, which then serves as a placeholder\nfor CTAD. This is allowed by [dcl.type.simple]/3. This patch\nfixes that problem by calling make_template_placeholder if we\nget a deducible template.\n\n\tPR c++/124706\n\ngcc/cp/ChangeLog:\n\n\t* parser.cc (cp_parser_splice_type_specifier): For ctad_template_p\n\tcall make_template_placeholder.\n\t* pt.cc (tsubst_splice_scope): Likewise.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/error10.C: Adjust dg-error.\n\t* g++.dg/reflect/type9.C: Likewise.\n\t* g++.dg/reflect/ctad1.C: New test.\n\t* g++.dg/reflect/ctad2.C: New test.\n---\n gcc/cp/parser.cc | 6 ++++\n gcc/cp/pt.cc | 2 ++\n gcc/testsuite/g++.dg/reflect/ctad1.C | 28 ++++++++++++++++++\n gcc/testsuite/g++.dg/reflect/ctad2.C | 41 ++++++++++++++++++++++++++\n gcc/testsuite/g++.dg/reflect/error10.C | 5 ++--\n gcc/testsuite/g++.dg/reflect/type9.C | 2 +-\n 6 files changed, 80 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/ctad1.C\n create mode 100644 gcc/testsuite/g++.dg/reflect/ctad2.C\n\n\nbase-commit: a8234bec74bda4ae1e507e1706053a5d781a4aa6", "diff": "diff --git a/gcc/cp/parser.cc b/gcc/cp/parser.cc\nindex cc59065848a..9f2641f2ab2 100644\n--- a/gcc/cp/parser.cc\n+++ b/gcc/cp/parser.cc\n@@ -6258,6 +6258,12 @@ cp_parser_splice_type_specifier (cp_parser *parser)\n if (dependent_splice_p (type))\n return make_splice_scope (type, /*type_p=*/true);\n \n+ /* [dcl.type.simple]/3: A type-specifier is a placeholder for a deduced\n+ class type if [...] it is of the form typename[opt] splice-specifier and\n+ the splice-specifier designates a class template or alias template. */\n+ if (ctad_template_p (type))\n+ type = make_template_placeholder (type);\n+\n if (!valid_splice_type_p (type))\n {\n if (!cp_parser_simulate_error (parser))\ndiff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex ca2c5301cca..2cf14e2c801 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -16901,6 +16901,8 @@ tsubst_splice_scope (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n return r;\n if (dependent_splice_p (r))\n return make_splice_scope (r, SPLICE_SCOPE_TYPE_P (t));\n+ if (SPLICE_SCOPE_TYPE_P (t) && ctad_template_p (r))\n+ r = make_template_placeholder (r);\n if (SPLICE_SCOPE_TYPE_P (t)\n ? !valid_splice_type_p (r)\n : !valid_splice_scope_p (r))\ndiff --git a/gcc/testsuite/g++.dg/reflect/ctad1.C b/gcc/testsuite/g++.dg/reflect/ctad1.C\nnew file mode 100644\nindex 00000000000..b733b8ba949\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/ctad1.C\n@@ -0,0 +1,28 @@\n+// PR c++/124706\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+using info = decltype(^^::);\n+\n+template <class T> struct X;\n+template <> struct X<int> {\n+ constexpr X(int) {}\n+};\n+X(int) -> X<int>;\n+\n+static constexpr auto template_info = ^^X;\n+\n+[:template_info:] y{ 13 };\n+\n+template<info R>\n+void\n+g ()\n+{\n+ typename [:R:] q{ 42 };\n+}\n+\n+void\n+f ()\n+{\n+ g<template_info>();\n+}\ndiff --git a/gcc/testsuite/g++.dg/reflect/ctad2.C b/gcc/testsuite/g++.dg/reflect/ctad2.C\nnew file mode 100644\nindex 00000000000..09e7e26af2a\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/ctad2.C\n@@ -0,0 +1,41 @@\n+// PR c++/124706\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+using info = decltype(^^::);\n+\n+template <class T>\n+struct A\n+{\n+ A(T);\n+};\n+[:^^A:] a(42);\n+typename [:^^A:] a2(42);\n+\n+template<typename T> struct B { T x; };\n+[:^^B:] b{0};\n+typename [:^^B:] b2{0};\n+\n+template<class T, class U>\n+struct X { X(U) {} };\n+\n+template<class U>\n+using Y = X<void, U>;\n+\n+[:^^Y:] y{1};\n+typename [:^^Y:] y2{1};\n+\n+template<info R>\n+void\n+g ()\n+{\n+ typename [:R:] x(42);\n+}\n+\n+void\n+f ()\n+{\n+ g<^^A>();\n+ g<^^B>();\n+ g<^^Y>();\n+}\ndiff --git a/gcc/testsuite/g++.dg/reflect/error10.C b/gcc/testsuite/g++.dg/reflect/error10.C\nindex 891a643c1a0..1ac171c73cc 100644\n--- a/gcc/testsuite/g++.dg/reflect/error10.C\n+++ b/gcc/testsuite/g++.dg/reflect/error10.C\n@@ -39,8 +39,7 @@ template<int>\n struct S {};\n \n void\n-fn5 (int, typename [: ^^S :] i) // { dg-error \"expected a reflection of a type|declared\" }\n-// { dg-message \"but .S. is a class template\" \"\" { target *-*-* } 39 }\n+fn5 (int, typename [: ^^S :] i) // { dg-error \"template placeholder not permitted in parameter\" }\n {\n }\n \n@@ -49,6 +48,6 @@ void bar ();\n \n void\n fn6 (int, typename [: ^^bar :] i) // { dg-error \"expected a reflection of a type|declared\" }\n-// { dg-message \"but .bar. is a function template\" \"\" { target *-*-* } 48 }\n+// { dg-message \"but .bar. is a function template\" \"\" { target *-*-* } 47 }\n {\n }\ndiff --git a/gcc/testsuite/g++.dg/reflect/type9.C b/gcc/testsuite/g++.dg/reflect/type9.C\nindex 56bed4590a5..2d0409e4b86 100644\n--- a/gcc/testsuite/g++.dg/reflect/type9.C\n+++ b/gcc/testsuite/g++.dg/reflect/type9.C\n@@ -32,7 +32,7 @@ template<info R> void fn9 () { int n = typename [:R:](42); } // { dg-error \"not\n template<info R> void fn10 () { int n = typename [:R:](42); } // { dg-error \"not usable in a splice type\" }\n template<info R> void fn11 () { int n = typename [:R:](42); } // { dg-error \"not usable in a splice type\" }\n template<info R> void fn12 () { int n = typename [:R:](42); } // { dg-error \"not usable in a splice type\" }\n-template<info R> void fn13 () { int n = typename [:R:](42); } // { dg-error \"not usable in a splice type\" }\n+template<info R> void fn13 () { int n = typename [:R:](42); } // { dg-error \"class template argument deduction failed|no matching\" }\n \n template void fn1<^^foo<int>>(); // { dg-message \"required from here\" }\n template void fn2<^^foo>();\t // { dg-message \"required from here\" }\n", "prefixes": [ "v2" ] }