[{"id":3681643,"web_url":"http://patchwork.ozlabs.org/comment/3681643/","msgid":"<61a930e0-e3eb-4fca-86af-75f268d15bf8@redhat.com>","list_archive_url":null,"date":"2026-04-23T19:16:31","subject":"Re: [PATCH v3] c++/reflection: ICE on member function template\n splicing [PR124794]","submitter":{"id":4337,"url":"http://patchwork.ozlabs.org/api/people/4337/","name":"Jason Merrill","email":"jason@redhat.com"},"content":"On 4/21/26 2:23 PM, feedable wrote:\n>>>>> gcc/testsuite/ChangeLog:\n>>>>>\n>>>>>      * g++.dg/reflect/splice12.C: New test.\n>>>\n>>> Note that this test will have to be renamed to splice13.C.\n>>>\n> \n> Done\n> \n>>>>> +          else if (BASELINK_P (expr))\n>>>>> +        expr  = build_baselink (access_path, BASELINK_BINFO (expr),\n>>>\n>>> Extra space before =.  Also I guess BASELINK_ACCESS_BINFO instead of\n>>> BASELINK_BINFO?\n>>\n>> We want to use access_path (relative to the actual object_type) in place of\n>> BASELINK_ACCESS_BINFO, but indeed the access path should be the second\n>> argument rather than the first in both this call and the existing one.\n> \n> If I understand correctly, access_path is the endpoint of the search, so it\n> should go into BASELINK_BINFO, and it's the object type that should go\n> into BASELINK_ACCESS_BINFO (in both cases, actually), since it's the\n> place where we started the search.\n\nAh, true.\n\n>>>>> -              member_access_p, template_p, targs_p,\n>>>>> +  if (!check_splice_expr (loc, expr.get_start (), MAYBE_BASELINK_FUNCTIONS\n>>>>> (t),\n>>>>\n>>>> I think it's probably preferable for check_splice_expr to handle getting a\n>>>> BASELINK, since tsubst_splice_expr.  Marek, thoughts?\n>>>\n>>> I think that's better.  It looks like we'll need MAYBE_BASELINK_FUNCTIONS\n>>> before the gcc_checking_assert at the end of check_splice_expr for the\n>>> get_template_info check.\n\nI was thinking that we could just\n\nt = MAYBE_BASELINK_FUNCTIONS (t);\n\nat the top of check_splice_expr rather than change multiple places in \nthe function?\n\n> @@ -21455,6 +21455,24 @@ tsubst_expr (tree t, tree args, tsubst_flags_t complain, tree in_decl)\n>   \telse\n>   \t  templ = tsubst_expr (templ, args, complain, in_decl);\n>   \n> +\t/* ??? tsubst_splice_expr may throw us for a loop and return an\n> +\t   address-of of the template decl instead of a plain template decl.\n> +\t   Substitute the template-id first, and the address-of expr after\n> +\t   that to get back on track.\n> +\t   The proper solution here is to emit the OFFSET_REF during parsing,\n> +\t   and get a clean template node from tsubst_splice_expr. However,\n> +\t   OFFSET_REF expr requires a type to build, which we wouldn't know\n> +\t   until the splice is performed. */\n\nWe can represent the address with ADDR_EXPR rather than OFFSET_REF; \nthat's already how we represent &C::f.\n\nIt might also make sense to move the template arguments inside the \nSPLICE_EXPR so that we have them available in tsubst_splice_expr.  This \nseems reasonable since they are part of the splice*specifier.\n\nWhat do you think, Marek?\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=H0d1WfZ6;\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=H0d1WfZ6","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 [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 4g1m7B2XZ9z1yCv\n\tfor <incoming@patchwork.ozlabs.org>; Fri, 24 Apr 2026 05:17:09 +1000 (AEST)","from vm01.sourceware.org (localhost [127.0.0.1])\n\tby sourceware.org (Postfix) with ESMTP id 3A8AB4BABF2F\n\tfor <incoming@patchwork.ozlabs.org>; Thu, 23 Apr 2026 19:17:07 +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 0F43F4BABF2F\n for <gcc-patches@gcc.gnu.org>; Thu, 23 Apr 2026 19:16:37 +0000 (GMT)","from mail-qv1-f69.google.com (mail-qv1-f69.google.com\n [209.85.219.69]) by relay.mimecast.com with ESMTP with STARTTLS\n (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id\n us-mta-110-64Xueo5BO2-crFPt1PqmFQ-1; Thu, 23 Apr 2026 15:16:35 -0400","by mail-qv1-f69.google.com with SMTP id\n 6a1803df08f44-8acafc224a8so176476986d6.1\n for <gcc-patches@gcc.gnu.org>; Thu, 23 Apr 2026 12:16:35 -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 6a1803df08f44-8b02ac68e76sm161737336d6.11.2026.04.23.12.16.33\n (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);\n Thu, 23 Apr 2026 12:16:33 -0700 (PDT)"],"DKIM-Filter":["OpenDKIM Filter v2.11.0 sourceware.org 3A8AB4BABF2F","OpenDKIM Filter v2.11.0 sourceware.org 0F43F4BABF2F"],"DMARC-Filter":"OpenDMARC Filter v1.4.2 sourceware.org 0F43F4BABF2F","ARC-Filter":"OpenARC Filter v1.0.0 sourceware.org 0F43F4BABF2F","ARC-Seal":"i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1776971797; cv=none;\n b=xoA0d70J5V9i9UEPiRm0t4JunE7Ixj4rnd7jMXYbrta9Pb9qNuLK61ra/5LVtTqw8Uo1lc6foHAQ5NdGlIyWT+JLhNxnyJx9lcrqGMxic9gAivM5QJzVfPAZSpd20UyU/xX7JP80Utz5uHRTWR8AwSqE5w3whJ3h7ndxaxHwdeU=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=sourceware.org; s=key;\n t=1776971797; c=relaxed/simple;\n bh=d3DhDM9pCkS6/vpkx/JWpkaNyKW+7FBOJoNgnTAHfa8=;\n h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From;\n b=iaLPwkCOIAZyCRttUKYfKCvhjJDOQ2zhH7bp3XhO6ZqbMdwpXXsOHXwpEbM6r2xGyhs3VvcLSGUsRwEv3jnAiK77Ge4gL8STkFm8jnAAH469hTplU52/saWz0IssDuDG4DofrE4DEx2A4OROWMW0kH+yTD7VDKV4hSw8TVm/lrs=","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=1776971796;\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=sBrlq2il2K2cC/+fEzfQYOhKNa42oecuTaepajEv2XE=;\n b=H0d1WfZ6B+Xph8PCpKp2GjVhr89xrSlqCRkdRFbyk4xjlCl5e7GAZojVa68OZMfllkKiIa\n kFTvKGuFVMSJKu2bmgIyDHgv0tZ8r3s6xiu3rtPK0NYa/LRqFPafJXN2XAGxztbPpLOMvR\n wjdhNY5I1+iPWQjOcdXQhPmFWp00MBM=","X-MC-Unique":"64Xueo5BO2-crFPt1PqmFQ-1","X-Mimecast-MFC-AGG-ID":"64Xueo5BO2-crFPt1PqmFQ_1776971795","X-Google-DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20251104; t=1776971795; x=1777576595;\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=sBrlq2il2K2cC/+fEzfQYOhKNa42oecuTaepajEv2XE=;\n b=nekpDWBv6mFTmBvCQTM+H4vx5mpOMffjR5Ltbknav4LRZhfO0CG3UA47K15/1IV8gv\n 264tLUTYEcTKsQA/JuPlWyUqdQAt736Lzr2pNGevodG1bYQbrJ2r+rbGs/FB3Xx2lsmT\n 4r/PMIdpnh3CllYL/o+Yusbs8W+H3YdOtLO1gIhdiGp7quhh/wfd0Vnf48lPrqv1+z+d\n 5Ec+0Gwacnr0EfbD9mWRjqqOztD+N4TQ8CeyxiH22PN8KwYa9qPmqJ2OCbIjJx3yMnkO\n Eg67tcQEdpZkcZXpRt+dmmyslhrfdUijPThmcatykXtzrtLFXBIv6QLo5nurjigY3mPJ\n iB3A==","X-Forwarded-Encrypted":"i=1;\n AFNElJ/3dO6kDZWA5fQttxfyakT45LrzsRz8ytgyoe9fxOrDlcAlrH/AUfTIxlyPFPnm1QmcTVAE8XFccQmTeA==@gcc.gnu.org","X-Gm-Message-State":"AOJu0Yw+rz+U2iUXoL0V3bI0N9/62DnqtV6cf4ZwQCQ8Zw033lcZdH3G\n n8/JD1ZC9D7k0kIb4ZD/st+fJ/CyBuzWsLhG2PreGODGfFPogg2lK4xc5yTiBpa/aYOG1FcjYvr\n qlXgxG/SsOqVqLKETk9z+ASffR8JJU7d3zHPTnGRDeGUBEr/OhRnAZ/wXY9s=","X-Gm-Gg":"AeBDievE69p0cpTiameAcmli3IftoajaJXxHHXmUdUcnDk7fc2ro+rc4PDBJnzDkCQY\n 1a85RVd5bHc4ACLAHHY0TEuxVXBGTuB4ynUP5H24AbrV6XNoXBdsXF6iQNoGW6Af5ReVRyocP/B\n tGwyFvx6UzzuPX/g91op5n9NtYxkk95sEExoojf/ifh7uXPXhzhKQAgUjI2zNXfrVaNzGhOt8AV\n sw+QLDvN9bhp4KUbGy5re7dcfA41hjRmtfJbXLXLm83i5LaRbiJNBnod5KsFQ1H570lFgtcTSPc\n 6K7al1hL2Qs4icziaeOggQILdfNAU+AhFdNAvheVeEDfkQCQrd+Hixq4Of5lNrUU2BfJX9ZHJME\n hB7LhkGvFQ4RwLF8yVQcTKWoJgtG7a4I6ySX3mGF4kqXIeBAeeDY4vyxwTTebh+KZNvqz6plyHp\n 1CvxuNu1rrepaCGPl3aB4/FEE3Eg6xwIZWKLeXTrr5EQ==","X-Received":["by 2002:a05:6214:8085:b0:8ac:a2f6:fbf7 with SMTP id\n 6a1803df08f44-8b02812ba4amr380367786d6.40.1776971794839;\n Thu, 23 Apr 2026 12:16:34 -0700 (PDT)","by 2002:a05:6214:8085:b0:8ac:a2f6:fbf7 with SMTP id\n 6a1803df08f44-8b02812ba4amr380367246d6.40.1776971794326;\n Thu, 23 Apr 2026 12:16:34 -0700 (PDT)"],"Message-ID":"<61a930e0-e3eb-4fca-86af-75f268d15bf8@redhat.com>","Date":"Thu, 23 Apr 2026 15:16:31 -0400","MIME-Version":"1.0","User-Agent":"Mozilla Thunderbird","Subject":"Re: [PATCH v3] c++/reflection: ICE on member function template\n splicing [PR124794]","To":"feedable <feedabl3@gmail.com>, gcc-patches@gcc.gnu.org","Cc":"Marek Polacek <polacek@redhat.com>","References":"<82c59580-b3a7-46b8-b2ed-e47ad70289ef@redhat.com>\n <20260421182406.362784-2-feedabl3@gmail.com>","From":"Jason Merrill <jason@redhat.com>","In-Reply-To":"<20260421182406.362784-2-feedabl3@gmail.com>","X-Mimecast-Spam-Score":"0","X-Mimecast-MFC-PROC-ID":"RXTUGWXF9M-zSkvJbzlnLl9y7fQ685TjWcmGTjlI96o_1776971795","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"}}]