[{"id":3675432,"web_url":"http://patchwork.ozlabs.org/comment/3675432/","msgid":"<a58cf962-7973-4a6c-a928-fc7f9094e28b@redhat.com>","list_archive_url":null,"date":"2026-04-09T18:10:54","subject":"Re: [PATCH v2] c++/reflection: reject invalid template splice\n [PR123998]","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"On 4/8/26 3:35 PM, Marek Polacek wrote:\n> On Thu, Apr 02, 2026 at 05:41:38PM -0400, Jason Merrill wrote:\n>> Can we switch to using a different function name for testing for a\n>> reflection of a function template, even if it just returns\n>> really_overloaded_fn?  This can be a later patch.\n> \n> Sure.  For 16 or 17?\n\nFor 16, to avoid backporting hassle.  Though I suppose that patch could \nbe backported first.\n\n>>> @@ -16810,13 +16810,18 @@ tsubst_splice_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n>>>    \tSET_SPLICE_EXPR_MEMBER_ACCESS_P (op, true);\n>>>          if (SPLICE_EXPR_ADDRESS_P (t))\n>>>    \tSET_SPLICE_EXPR_ADDRESS_P (op, true);\n>>> +      if (SPLICE_EXPR_TEMPLATE_P (t))\n>>> +\tSET_SPLICE_EXPR_TEMPLATE_P (op, true);\n>>>          return op;\n>>>        }\n>>> +  const bool targs_p = (TREE_CODE (t) == TEMPLATE_ID_EXPR\n>>> +\t\t\t|| variable_template_p (op));\n>>\n>> Why || variable_template_p?  Can't you have a variable template reflection\n>> without targs?\n> \n> I was trying to avoid adding SPLICE_EXPR_TARGS_P but it's probably not\n> going to work too well.  And the == TEMPLATE_ID_EXPR check can never\n> be true.\n> \n> So this patch adds SPLICE_EXPR_TARGS_P so that we can check we're\n> coming from [:R:]<args> in the SPLICE_EXPR.  With that, I had to\n> add an error for DECL_TYPE_TEMPLATE_P in check_splice_expr to avoid\n> crashing in crash11.C.\n> \n> Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk?\n\nOK.\n\nJason","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=ORrTzgjR;\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=ORrTzgjR","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 4fs7LB3yKyz1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 10 Apr 2026 04:11:46 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 85AE94BA2E10\n\tfor <incoming@patchwork.ozlabs.org>; Thu,  9 Apr 2026 18:11:44 +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 8BF684BA2E0D\n for <gcc-patches@gcc.gnu.org>; Thu,  9 Apr 2026 18:10:58 +0000 (GMT)","from mail-qt1-f200.google.com (mail-qt1-f200.google.com\n [209.85.160.200]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-58-Y8axyt4QPvWYgFYBTbw4RA-1; Thu, 09 Apr 2026 14:10:57 -0400","by mail-qt1-f200.google.com with SMTP id\n d75a77b69052e-50b4076dc16so50910461cf.2\n for <gcc-patches@gcc.gnu.org>; Thu, 09 Apr 2026 11:10:57 -0700 (PDT)","from [192.168.50.130]\n (130-44-146-247.s12789.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com.\n [130.44.146.247]) by smtp.gmail.com with ESMTPSA id\n d75a77b69052e-50dd5637f4fsm2146631cf.28.2026.04.09.11.10.54\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Thu, 09 Apr 2026 11:10:54 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 85AE94BA2E10","OpenDKIM Filter v2.11.0 sourceware.org 8BF684BA2E0D"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 8BF684BA2E0D","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 8BF684BA2E0D","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1775758258; cv=none;\n b=LSRY5qRt6CSsBWpK7a8vP+HnJ5TMIAph9iCIOuveHyWuRloCWFXibVGlMC4p5sU/IQRcofMdiW2vTQv7rb9v7TvyMWUGqYzo6IR0DEAX7xLicalQeZBMMHTc3TaU4zyITtwLhKJVLOqtpdE/LGlSIX1QOVFPoACCYbCDu7uvtJQ=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1775758258; c=relaxed/simple;\n bh=Qz83oiZ316LeTnoFJUgidzv7e1x1g2eHvT7jOSUxq40=;\n h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;\n b=EC3LmPCM0/RyeyTs/46fq7GY8JImjwkK4v+BgxYm2110LYho2+663Rp5QFNYX/g6oWpO64yg/UG8icSErw3pRcDWI+dC0qji2gqPOUzDBvLqwlzSk3avJCSm/fUtuwo1zbXdqdv0vVhdsp56toNu4I8paPlfb41kY1to86GlR5U=","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=1775758258;\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 content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=yH0/2exwtSzc3/y+EZUGtMvCEE7jP6dmu2WqQV4WSCE=;\n b=ORrTzgjRegqNyl3xEtlByVqbR1L6w1+4oNd2b+2QzNMVRYvrnm6eaVr/woe08twynfGOO/\n oNoX4YA/yXehxk6rOj4SEH2YPr3tr88CmI4hSzqfPOb+FLlCwo6JbSG/HpoebOoKcxeCEE\n G87t/IlecDNIouwgeGcNm4YdkBNxkZ0=","X-MC-Unique":"Y8axyt4QPvWYgFYBTbw4RA-1","X-Mimecast-MFC-AGG-ID":"Y8axyt4QPvWYgFYBTbw4RA_1775758256","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1775758256; x=1776363056;\n h=content-transfer-encoding:in-reply-to:from:content-language\n :references:cc:to:subject:user-agent:mime-version:date:message-id\n :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id\n :reply-to;\n bh=yH0/2exwtSzc3/y+EZUGtMvCEE7jP6dmu2WqQV4WSCE=;\n b=Oq2YOvvEXntrB4Oh1dpHHSXGpo/eMnZtpdyz+OQXzLpSyxsDqQeCCmOET5tL9Yh7wI\n fIh0HFHWhOgX4nMR+uH6AcwOxI6xZ5bBmbe31DIZ895EE7AK+LnFlknYujHFANsr90Nw\n PpPoa7C6nfU7WeWsVy7CAjDT0TxlP4ugNZXx9q5Qy+trxApi3moeKwOAOoPWhpVwK+9S\n 7Kip1tpGa1dqUuIHVcVBGz020M0+j4I33uSval1L02/546Ipukr1x1eAylt5UKkUltwX\n 6BFOrslahWjrgbf2BA8G6JWtl7/APPG7gy5CnlIY+I2ZAiXlwoWQGXcnrVPTo9Kus5oa\n HZlA==","X-Gm-Message-State":"AOJu0Yy3FsKks17YgQ7usT+uKi1rChHANo0oVuaH1WDPsYXpxm/F7jnb\n 7OIISZGOq5lePOoqSM115xTizPWGcz4EFVHuZ9P4GmxKyuVUj0FycMvNKCtQWYqTepwbSFzbQ+C\n 1InzCpyu1jxVQbxJ0mbAzpCkbsPlBrY62t9elf/BHn6z7UOzXWv2AhXQawAU=","X-Gm-Gg":"AeBDietxBmTCG7Dl8kZ8vFRwFZfXSsjgWPaEgyBOGd4i6qdpsiHcjt314WnD9UpTrmi\n NY5k4KZ1zZ80/orcCRsJY9O8qdSxloSWNuyJCb+VHevUPvF6wCtwQwT701NPwg91YCAzrm3Uh0v\n hnT4s7HJOwx78uZ09C26q5GxQSaJrplP/wpf5D0KSU7CUhuOKNj+hcFId3DbN1wM8ALgKaYuz9z\n tBgSk1Uy4kKk+6OxxgSuQ95O41wo/V02OMp6ypRYt7V6wGf6fhSHi5cZmIv91sETHLlB/2Jx7uP\n HF2PMxMVdJygftkna9ATpFq6sIXXeFvfa1+yagOcNg+KH+F3O2OG7ouezfogj9BZoHk3J2IImg+\n YaTWDr+9wdDEcxBPUBnOjcbIn+UfTe7P4kBa8l8Xe3ZxqM+2gBR04IjUd9ubzS3wHzeu3TmLz0z\n Ge6t2NHFyAqmPfHEDvVtkigXpO82Xxs8o=","X-Received":["by 2002:a05:622a:2295:b0:50b:47ae:8abd with SMTP id\n d75a77b69052e-50dd5b96015mr3509611cf.2.1775758256315;\n Thu, 09 Apr 2026 11:10:56 -0700 (PDT)","by 2002:a05:622a:2295:b0:50b:47ae:8abd with SMTP id\n d75a77b69052e-50dd5b96015mr3508931cf.2.1775758255747;\n Thu, 09 Apr 2026 11:10:55 -0700 (PDT)"],"Message-ID":"<a58cf962-7973-4a6c-a928-fc7f9094e28b@redhat.com>","Date":"Thu, 9 Apr 2026 14:10:54 -0400","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v2] c++/reflection: reject invalid template splice\n [PR123998]","To":"Marek Polacek <polacek@redhat.com>","Cc":"GCC Patches <gcc-patches@gcc.gnu.org>, Jakub Jelinek <jakub@redhat.com>","References":"<20260320205155.212366-1-polacek@redhat.com>\n <735f0b6a-be78-4608-b8cf-e6293a254d5c@redhat.com>\n <adat_NaPJs-bKBVb@redhat.com>","From":"Jason Merrill <jason@redhat.com>","In-Reply-To":"<adat_NaPJs-bKBVb@redhat.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"ldPuPoUIX_1hd66C6uwAu_Bz2A1Bf4wJL2ZnUA9tnXE_1775758256","X-Mimecast-Originator":"redhat.com","Content-Language":"en-US","Content-Type":"text/plain; charset=UTF-8; format=flowed","Content-Transfer-Encoding":"7bit","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"}}]