{"id":2230594,"url":"http://patchwork.ozlabs.org/api/patches/2230594/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/patch/20260429220337.494176-1-polacek@redhat.com/","project":{"id":17,"url":"http://patchwork.ozlabs.org/api/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,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260429220337.494176-1-polacek@redhat.com>","list_archive_url":null,"date":"2026-04-29T22:03:36","name":"c++/reflection: propagate cv-quals for SPLICE_SCOPE [PR125096]","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"40e63680dde9f91cf5b4a1cc3bf8ecb17c126869","submitter":{"id":14370,"url":"http://patchwork.ozlabs.org/api/people/14370/?format=json","name":"Marek Polacek","email":"polacek@redhat.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/gcc/patch/20260429220337.494176-1-polacek@redhat.com/mbox/","series":[{"id":502160,"url":"http://patchwork.ozlabs.org/api/series/502160/?format=json","web_url":"http://patchwork.ozlabs.org/project/gcc/list/?series=502160","date":"2026-04-29T22:03:36","name":"c++/reflection: propagate cv-quals for SPLICE_SCOPE [PR125096]","version":1,"mbox":"http://patchwork.ozlabs.org/series/502160/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2230594/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2230594/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=gKiV0wz0;\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=gKiV0wz0","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 4g5WYB2c4xz1yGq\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 30 Apr 2026 08:04:13 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 0B82D4B920E4\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 29 Apr 2026 22:04:11 +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 4F0014BB593E\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 22:03:43 +0000 (GMT)","from mx-prod-mc-08.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-35-165-154-97.us-west-2.compute.amazonaws.com [35.165.154.97]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-94-m2qKwj1pMC-t0khKQv9a0A-1; Wed,\n 29 Apr 2026 18:03:41 -0400","from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\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-08.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id A71941800367\n for <gcc-patches@gcc.gnu.org>; Wed, 29 Apr 2026 22:03:40 +0000 (UTC)","from pdp-11.redhat.com (unknown [10.22.89.65])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 1C047300019F; Wed, 29 Apr 2026 22:03:40 +0000 (UTC)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 0B82D4B920E4","OpenDKIM Filter v2.11.0 sourceware.org 4F0014BB593E"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 4F0014BB593E","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 4F0014BB593E","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1777500223; cv=none;\n b=YgeGwo6Km7NCB7LoE9mrJDW0JCdDyuiTEREcEi/7zOvRe3xI5vR6hDDtDEyaaVeVxD0h7SqX8BKCzGxonnDE8GhSvTTP7IkhSl9G7W0u3hFxcDAhoDjc9tlBNbsIisVl0bAa6UHUzoQUUGVv//ynoLfsmdUopXeTozik65ft9bw=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1777500223; c=relaxed/simple;\n bh=BcpK8CYHwygtI+lVAmIRHkRd/mrgQDG+cne3T9pI21g=;\n h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version;\n b=Ng5n1tMJnWxwxK33a0kbRTgLl6pf14Udh07sjlOBkSaAJ6C4Emfqz0j3242z1wGLdFDaQqmYcVGLLgDoZx77SsDi1eD20olfDqz99W+dvnLExwBcj4PbCf825EGKKQC61uyqWol/3mo+6vrZsgz88FXgxWt7wl1IHW/rH07/y7o=","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=1777500222;\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=VXXMz3JV7t6GqAHNIm9D7cJiDZX3+SqsnTCr8Acrz5s=;\n b=gKiV0wz0HSbVL8xwSKckHfgasgtiMfcIlgpbw+yJlwvPxeahC32k/7Pu2exH94m/UU8JXt\n 4kgKNDgYG1lGePCMDFpGPM5DKzDUgQayfOeEzOMOCdVBJmM8Fn8B9f4VVEXRgzgkPz8AVk\n 7zMrHn0tNZIy2BBv8YLLN20CuZ7RYsU=","X-MC-Unique":"m2qKwj1pMC-t0khKQv9a0A-1","X-Mimecast-MFC-AGG-ID":"m2qKwj1pMC-t0khKQv9a0A_1777500220","From":"Marek Polacek <polacek@redhat.com>","To":"Jason Merrill <jason@redhat.com>,\n\tGCC Patches <gcc-patches@gcc.gnu.org>","Subject":"[PATCH] c++/reflection: propagate cv-quals for SPLICE_SCOPE\n [PR125096]","Date":"Wed, 29 Apr 2026 18:03:36 -0400","Message-ID":"<20260429220337.494176-1-polacek@redhat.com>","MIME-Version":"1.0","X-Scanned-By":"MIMEDefang 3.4.1 on 10.30.177.4","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"1fjHgFXFLQnuWtOORd13mts8qvDTKy_PeN0-T5sFXGQ_1777500220","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":"Regtest on x86_64-pc-linux-gnu in progress but reflect/* has passed.\nOk for trunk/16.2?\n\n-- >8 --\ntsubst_splice_scope isn't propagating cv-quals from the template tree\nto the result, which means wrongly failed asserts in the new test due to\na missing 'const'.  So let's add the cv-quals like we do in so many\nother places in tsubst.\n\n\tPR c++/125096\n\ngcc/cp/ChangeLog:\n\n\t* pt.cc (tsubst_splice_scope): Don't return early for\n\tdependent_splice_p.  Propagate cv-qualifiers from the\n\tSPLICE_SCOPE to the result.\n\t* reflect.cc (valid_splice_scope_p): Accept SPLICE_SCOPE.\n\ngcc/testsuite/ChangeLog:\n\n\t* g++.dg/reflect/mangle4.C: Move dg-error.\n\t* g++.dg/reflect/dep16.C: New test.\n---\n gcc/cp/pt.cc                           |  8 ++++++--\n gcc/cp/reflect.cc                      |  3 ++-\n gcc/testsuite/g++.dg/reflect/dep16.C   | 28 ++++++++++++++++++++++++++\n gcc/testsuite/g++.dg/reflect/mangle4.C |  5 ++---\n 4 files changed, 38 insertions(+), 6 deletions(-)\n create mode 100644 gcc/testsuite/g++.dg/reflect/dep16.C\n\n\nbase-commit: f4b5c2bf40d68e1666c83556a236a53cdddc34a2","diff":"diff --git a/gcc/cp/pt.cc b/gcc/cp/pt.cc\nindex 9a5eb7ef9b0..6992b5196fe 100644\n--- a/gcc/cp/pt.cc\n+++ b/gcc/cp/pt.cc\n@@ -16904,8 +16904,8 @@ tsubst_splice_scope (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n     return r;\n   const bool type_p = SPLICE_SCOPE_TYPE_P (t);\n   if (dependent_splice_p (r))\n-    return make_splice_scope (r, type_p);\n-  if (type_p && ctad_template_p (r))\n+    r = make_splice_scope (r, type_p);\n+  else if (type_p && ctad_template_p (r))\n     r = make_template_placeholder (r);\n   if (type_p\n       ? !valid_splice_type_p (r)\n@@ -16925,6 +16925,10 @@ tsubst_splice_scope (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n       return error_mark_node;\n     }\n \n+  if (type_p)\n+    r = cp_build_qualified_type (r, cp_type_quals (t) | cp_type_quals (r),\n+\t\t\t\t complain | tf_ignore_bad_quals);\n+\n   return r;\n }\n \ndiff --git a/gcc/cp/reflect.cc b/gcc/cp/reflect.cc\nindex c6b0f6f2bd1..3b9f56ea548 100644\n--- a/gcc/cp/reflect.cc\n+++ b/gcc/cp/reflect.cc\n@@ -8912,7 +8912,8 @@ valid_splice_scope_p (const_tree t)\n {\n   return (CLASS_TYPE_P (t)\n \t  || TREE_CODE (t) == ENUMERAL_TYPE\n-\t  || TREE_CODE (t) == NAMESPACE_DECL);\n+\t  || TREE_CODE (t) == NAMESPACE_DECL\n+\t  || TREE_CODE (t) == SPLICE_SCOPE);\n }\n \n /* Return true if T is a valid result of the splice in a class member access,\ndiff --git a/gcc/testsuite/g++.dg/reflect/dep16.C b/gcc/testsuite/g++.dg/reflect/dep16.C\nnew file mode 100644\nindex 00000000000..70ec9bf4858\n--- /dev/null\n+++ b/gcc/testsuite/g++.dg/reflect/dep16.C\n@@ -0,0 +1,28 @@\n+// PR c++/125096\n+// { dg-do compile { target c++26 } }\n+// { dg-additional-options \"-freflection\" }\n+\n+#include <meta>\n+#include <vector>\n+\n+namespace ctp {\n+    template <class T> struct Reflect;\n+\n+    namespace impl {\n+        template <class T> using custom_target = Reflect<T>::target_type;\n+    }\n+\n+    template <class T>\n+    using target = [: is_scalar_type(^^T) ? ^^T : substitute(^^impl::custom_target, {^^T}) :];\n+\n+    template <class T>\n+    struct Reflect<std::vector<T>> {\n+        using underlying = target<T> const;\n+        using target_type = std::span<const target<T>>;\n+    };\n+}\n+\n+static_assert(dealias(^^ctp::target<int>) == ^^int);\n+static_assert(dealias(^^ctp::target<std::vector<int>>) == ^^std::span<int const>);\n+static_assert(dealias(^^ctp::Reflect<std::vector<int>>::underlying) == ^^int const);\n+static_assert(dealias(^^ctp::Reflect<std::vector<int>>::target_type) == ^^std::span<int const>);\ndiff --git a/gcc/testsuite/g++.dg/reflect/mangle4.C b/gcc/testsuite/g++.dg/reflect/mangle4.C\nindex 3880468daff..f9ac44ba869 100644\n--- a/gcc/testsuite/g++.dg/reflect/mangle4.C\n+++ b/gcc/testsuite/g++.dg/reflect/mangle4.C\n@@ -20,7 +20,6 @@ template<random_access_iterator I>\n }\n \n int main() {\n-  // ??? It's not clear which of these should error.\n-  std::default_accessor<int>       _ = std::iterator_accessor<int*>();\n-  std::default_accessor<const int> _ = std::iterator_accessor<int*>(); // { dg-error \"conversion\" }\n+  std::default_accessor<int>       _ = std::iterator_accessor<int*>(); // { dg-error \"conversion\" }\n+  std::default_accessor<const int> _ = std::iterator_accessor<int*>();\n }\n","prefixes":[]}