Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2226638/?format=api
{ "id": 2226638, "url": "http://patchwork.ozlabs.org/api/patches/2226638/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/patch/20260422172510.801133-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": "<20260422172510.801133-1-polacek@redhat.com>", "list_archive_url": null, "date": "2026-04-22T17:25:10", "name": "c++/reflection: reflect on dependent class template [PR124926]", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "be413a4feb5bf5b1bd396a7a223fc16b92025b26", "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/20260422172510.801133-1-polacek@redhat.com/mbox/", "series": [ { "id": 501050, "url": "http://patchwork.ozlabs.org/api/series/501050/?format=api", "web_url": "http://patchwork.ozlabs.org/project/gcc/list/?series=501050", "date": "2026-04-22T17:25:10", "name": "c++/reflection: reflect on dependent class template [PR124926]", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/501050/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2226638/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2226638/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=U4dR2CF4;\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 (1024-bit key,\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=U4dR2CF4", "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.129.124" ], "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 4g15j85x3Dz1y2d\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 03:25:47 +1000 (AEST)", "from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id C8B854BB3BD8\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 17:25:44 +0000 (GMT)", "from us-smtp-delivery-124.mimecast.com\n (us-smtp-delivery-124.mimecast.com [170.10.129.124])\n by sourceware.org (Postfix) with ESMTP id C7D534BB3BCF\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 17:25:16 +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-319-1-9s1ZaAMcGHG3PDa72OCQ-1; Wed,\n 22 Apr 2026 13:25:15 -0400", "from mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.12])\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 4A0AA1956088\n for <gcc-patches@gcc.gnu.org>; Wed, 22 Apr 2026 17:25:14 +0000 (UTC)", "from pdp-11.redhat.com (unknown [10.22.80.162])\n by mx-prod-int-03.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id C6F8B19560AB; Wed, 22 Apr 2026 17:25:13 +0000 (UTC)" ], "DKIM-Filter": [ "OpenDKIM Filter v2.11.0 sourceware.org C8B854BB3BD8", "OpenDKIM Filter v2.11.0 sourceware.org C7D534BB3BCF" ], "DMARC-Filter": "OpenDMARC Filter v1.4.2 sourceware.org C7D534BB3BCF", "ARC-Filter": "OpenARC Filter v1.0.0 sourceware.org C7D534BB3BCF", "ARC-Seal": "i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776878716; cv=none;\n b=aLg21jhikXKFmYALWZnR52q/jXU+E+XTOTyiNiMRsHIBubXcJiwb6eHA5E5HNuMkSMmxrKXf+Dp6HrYufB1dMXchUt9DJA+CgOrrWLJEhGDZQfLUTtxcNMYddaOB1cgzfqEoFUP+mIwmHOIiGnWGnh39/ymEcfdtlgAcY3BFEzA=", "ARC-Message-Signature": "i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776878716; c=relaxed/simple;\n bh=6DijSur28IDsK2hWcNhMzUaZkdeq5cPXE8nu9Ckwloc=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=vBTrgfHMG3FcDaRr1qecujlm/fOPiO58tF4v8o5NyxJeZ84nx0Vwl6i8kwd9Zgp119PodQpx2U5PG21OLrIfVJjuQHlD7vqyIk0876eTkbXsLWUYhHJ70D104coCx28fdBfiPKNAKrfvLaon2Ywv16egYLMxL0X60rBdamr4Bc4=", "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=1776878716;\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=IvUa0W4kns+83c9PCqiG2Zhop5LYVv5EDvpjIFt0APk=;\n b=U4dR2CF4Z9FzWNEtgW78ZMchWObXh+sw0IQeg8FB3KDalxEvio8d+E6C3nlnogIsfW5+eO\n Kes4WxxLkqTpBgTHu+7jyqXoMAv2XAwdKOO1tz4/Jx/iy51ZWlEASIVnz3sSKjoH3tWIog\n LsA4qt7up+0UGR5uU11c9b872mrnQcI=", "X-MC-Unique": "1-9s1ZaAMcGHG3PDa72OCQ-1", "X-Mimecast-MFC-AGG-ID": "1-9s1ZaAMcGHG3PDa72OCQ_1776878714", "From": "Marek Polacek <polacek@redhat.com>", "To": "GCC Patches <gcc-patches@gcc.gnu.org>,\n\tJason Merrill <jason@redhat.com>", "Subject": "[PATCH] c++/reflection: reflect on dependent class template\n [PR124926]", "Date": "Wed, 22 Apr 2026 13:25:10 -0400", "Message-ID": "<20260422172510.801133-1-polacek@redhat.com>", "MIME-Version": "1.0", "X-Scanned-By": "MIMEDefang 3.0 on 10.30.177.12", "X-Mimecast-Spam-Score": "0", "X-Mimecast-MFC-PROC-ID": "kLryPd1iM233X6XYhB1QD_Wgs4UYLdnyQ4Od7oaFiec_1776878714", "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 --\nHere we issue a bogus error for\n\n ^^Cls<T>::template Inner\n\nwhere Inner turns out to be a class type, but we created a SCOPE_REF\nbecause we can't know in advance what it will substitute into, and\n\n ^^typename Cls<T>::template Inner\n\nis invalid. The typename can only be used in\n\n ^^typename Cls<T>::template Inner<int>\n\nWe're taking a reflection so both types and non-types are valid, so\nI think we shouldn't give the error for ^^, and take the reflection\nof the TEMPLATE_DECL.\n\n\tPR c++/124926\n\ngcc/cp/ChangeLog:\n\n\t* pt.cc (tsubst_qualified_id): New bool parameter. Don't give the\n\t\"instantiation yields a type\" error when the new parameter is true.\n\t(tsubst_expr) <case REFLECT_EXPR>: Adjust the call to\n\ttsubst_qualified_id.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/dep15.C: New test.\n---\n gcc/cp/pt.cc | 13 +++--\n gcc/testsuite/g++.dg/reflect/dep15.C | 85 ++++++++++++++++++++++++++++\n 2 files changed, 94 insertions(+), 4 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/dep15.C\n\n\nbase-commit: cb70dab0e4bfa94e009700086001a5b2dc17ea5d", "diff": "diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 5d97ca7997f..f73805b2557 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -18238,12 +18238,14 @@ tsubst_baselink (tree baselink, tree object_type,\n true if the qualified-id will be a postfix-expression in-and-of\n itself; false if more of the postfix-expression follows the\n QUALIFIED_ID. ADDRESS_P is true if the qualified-id is the operand\n- of \"&\". NAME_LOOKUP_P is true if we intend to perform name lookup. */\n+ of \"&\". NAME_LOOKUP_P is true if we intend to perform name lookup.\n+ REFLECTING_P is true if this SCOPE_REF is an operand of ^^. */\n \n static tree\n tsubst_qualified_id (tree qualified_id, tree args,\n \t\t tsubst_flags_t complain, tree in_decl,\n-\t\t bool done, bool address_p, bool name_lookup_p = true)\n+\t\t bool done, bool address_p, bool name_lookup_p = true,\n+\t\t bool reflecting_p = false)\n {\n tree expr;\n tree scope;\n@@ -18322,7 +18324,9 @@ tsubst_qualified_id (tree qualified_id, tree args,\n else\n \texpr = lookup_qualified_name (scope, expr, LOOK_want::NORMAL, false);\n if (TREE_CODE (TREE_CODE (expr) == TEMPLATE_DECL\n-\t\t ? DECL_TEMPLATE_RESULT (expr) : expr) == TYPE_DECL)\n+\t\t ? DECL_TEMPLATE_RESULT (expr) : expr) == TYPE_DECL\n+\t /* For ^^T::X, we'll take both types and non-types. */\n+\t && !reflecting_p)\n \t{\n \t if (complain & tf_error)\n \t {\n@@ -23355,7 +23359,8 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n \telse if (TREE_CODE (h) == SCOPE_REF)\n \t h = tsubst_qualified_id (h, args, complain, in_decl,\n \t\t\t\t /*done=*/true, /*address_p=*/false,\n-\t\t\t\t /*name_lookup_p=*/false);\n+\t\t\t\t /*name_lookup_p=*/false,\n+\t\t\t\t /*reflecting_p=*/true);\n \telse\n \t {\n \t /* [expr.reflect] The id-expression of a reflect-expression is\ndiff --git a/gcc/testsuite/g++.dg/reflect/dep15.C b/gcc/testsuite/g++.dg/reflect/dep15.C\nnew file mode 100644\nindex 00000000000..40273955164\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/dep15.C\n@@ -0,0 +1,85 @@\n+// PR c++/124926\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+template <typename T, typename U>\n+constexpr bool is_same_v = false;\n+\n+template <typename T>\n+constexpr bool is_same_v<T, T> = true;\n+\n+// Class template\n+template <typename>\n+struct C1 {\n+ template <typename> struct Inner {};\n+};\n+\n+template <typename T>\n+constexpr auto vt1 = ^^C1<T>::template Inner;\n+constexpr auto r1 = vt1<int>;\n+typename [:r1:]<int> a;\n+static_assert(r1 == ^^C1<int>::template Inner);\n+static_assert(is_same_v<decltype(a), C1<int>::Inner<int>>);\n+\n+// Class template with typename\n+template <typename>\n+struct C6 {\n+ template <typename> struct Inner {};\n+};\n+\n+template <typename T>\n+constexpr auto vt6 = ^^typename C6<T>::template Inner<T>;\n+constexpr auto r6 = vt6<int>;\n+typename [:r6:] d;\n+static_assert(r6 == ^^C6<int>::template Inner<int>);\n+static_assert(is_same_v<decltype(d), C6<int>::Inner<int>>);\n+\n+// Variable template\n+template <typename>\n+struct C2 {\n+ template <typename> static constexpr int Inner = 42;\n+};\n+\n+template <typename T>\n+constexpr auto vt2 = ^^C2<T>::template Inner;\n+constexpr auto r2 = vt2<int>;\n+constexpr int i = template [:r2:]<int>;\n+static_assert(i == 42);\n+static_assert(vt2<int> == ^^C2<int>::template Inner);\n+\n+// Function template\n+template <typename>\n+struct C3 {\n+ template <typename T> static constexpr int Inner (T t) { return t; };\n+};\n+template <typename T>\n+constexpr auto vt3 = ^^C3<T>::template Inner;\n+constexpr auto r3 = vt3<int>;\n+static_assert(template [:r3:](42) == 42);\n+static_assert(vt3<int> == ^^C3<int>::template Inner);\n+\n+// Alias template\n+template <typename>\n+struct C4 {\n+ template <typename T> using Inner = C4<T>;\n+};\n+template <typename T>\n+constexpr auto vt4 = ^^C4<T>::template Inner;\n+constexpr auto r4 = vt4<int>;\n+typename [:r4:]<int> b;\n+static_assert(is_same_v<decltype(b), C4<int>>);\n+static_assert(vt4<int> == ^^C4<int>::template Inner);\n+\n+// Alias template with typename\n+template<typename T> struct X { };\n+\n+template <typename>\n+struct C5 {\n+ template <typename T> using Inner = X<T>;\n+};\n+template <typename T>\n+constexpr auto vt5 = ^^typename C5<T>::template Inner<T>;\n+constexpr auto r5 = vt5<int>;\n+typename [:r5:] c;\n+static_assert(is_same_v<decltype(c), X<int>>);\n+static_assert(vt5<int> == ^^C5<int>::template Inner<int>);\n", "prefixes": [] }