From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id A72563858CD1 for ; Mon, 27 Nov 2023 02:41:02 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org A72563858CD1 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org A72563858CD1 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701052866; cv=none; b=o1Jkj9luJ/Lfyn1FQSxgLvOyIUB4NDEeaXLjJxBBJEUQwxsBDiNdTh6zOUGOyQMOl3Kk6ZD2UBeFRDHNhAgCtglzTjn2tNlurgsmmHW12SEB7TtRwEHGz0ZcBRrDCYyGPlAbDiFwMDXPtOlmrYgQ4xjAAEcN0up1yHeA3rejeuM= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1701052866; c=relaxed/simple; bh=HpBtubCFtZIKeKKgO69KnvrTg8552XYEYcbrR3fbKrQ=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=Dy7vH+7VkOzqXVMPzVeDKzDzjmnVMHTzsvMWxrdaj8b6WcOBO73V4k/dG6nhhPPhvEGPjmeZjoehTmOo3k8Dky93YrjRiQX7psIOg4H8Sw9EQs3TNwDUo6BA6RTkV4RBeeIO1pcWWh6xWNPonqth5r0cwNWsaVPj+odfuR9y9O0= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1701052862; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=oVyVE7b5IZbXhY94SFdy3GkhsZE+4iGr0CzND6nEK+Q=; b=JKcYbXWKGvCfe1qt6LRXPPpFltX3F7ikhf4m3hmt5QepLFRnJgBtW7apAu15Xly6BEC0RO BLJTcnl4qmSFZeD36n0NyZ+m4lJm0l6DpBUDqD43EDvKxWD13odfPhNTnc0rMKb6xtQSik 2POkClerKR2/f3Bf+2O4++HiK9dTskk= Received: from mail-qv1-f70.google.com (mail-qv1-f70.google.com [209.85.219.70]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-558-ITRKfjZ1O9OhlDXluLn0Jw-1; Sun, 26 Nov 2023 21:41:00 -0500 X-MC-Unique: ITRKfjZ1O9OhlDXluLn0Jw-1 Received: by mail-qv1-f70.google.com with SMTP id 6a1803df08f44-677e7daa85fso39389596d6.2 for ; Sun, 26 Nov 2023 18:41:00 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1701052860; x=1701657660; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=oVyVE7b5IZbXhY94SFdy3GkhsZE+4iGr0CzND6nEK+Q=; b=Qv2G8F8gdXDhVMixfCEp1ZiwGD0O9eZaT4lTNBGjjRq8XKdtfoFscde90X2ewkGrOY BmYsI75/jMooZje3b6YhCE1KlhJ1wCA7plBFgNs0dHzBWjD/wnZCw1zztdMMRwKzXBkR AvxeDqmBPxrubxPA440+fxkQZiTS9sEQSYgkU0y8Th383ojCZOLiNMGiPk52lxio0JUM VF9zN74YLW1GG4eEESMyT/h8EL/t8DdsVb4cKvI2cj8ar+75NrvRuHtQZ4kNbTBRqAIP 5+M6o2KOBFGgHft+ntLf1HDqs40/6xP0jenECCChT7LJlcuy468c2dqhTf+oZwo6D4pE Sh+w== X-Gm-Message-State: AOJu0YxCSP+20DsZbW6lQWf6shHzsMcxYol9yFSshwlZWleyMG/r8gAU 7N/qcKKCLGYmBXaa+bBwzz4bEh9tTrtDKzB4YDbLEgvfsXVexYbIS2Gj82v1G/Vr67l1ZD++D2E UY9y1SC2dXfmyyQwU4TPqN0+LXQ== X-Received: by 2002:a05:6214:aab:b0:67a:2261:4e3d with SMTP id ew11-20020a0562140aab00b0067a22614e3dmr7250725qvb.19.1701052860116; Sun, 26 Nov 2023 18:41:00 -0800 (PST) X-Google-Smtp-Source: AGHT+IGaxyNCnRWcIbEp0U9ggHcqum9HmpVgX69geugvhEk7D/JTBaooGqDOr/KwRnROtPZIhElMuw== X-Received: by 2002:a05:6214:aab:b0:67a:2261:4e3d with SMTP id ew11-20020a0562140aab00b0067a22614e3dmr7250716qvb.19.1701052859831; Sun, 26 Nov 2023 18:40:59 -0800 (PST) Received: from [192.168.1.145] (130-44-146-16.s12558.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.146.16]) by smtp.gmail.com with ESMTPSA id u2-20020a0cf882000000b0067a3abec392sm996615qvn.66.2023.11.26.18.40.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 26 Nov 2023 18:40:58 -0800 (PST) Message-ID: <2a2b843b-6950-45a6-8cfa-5806adaf7786@redhat.com> Date: Sun, 26 Nov 2023 21:40:58 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v5 1/1] c++: Initial support for P0847R7 (Deducing This) [PR102609] To: waffl3x Cc: "gcc-patches@gcc.gnu.org" References: <7Xr5Vil7ptZzPaCtc_ZCdcTPuUVY7dheOnklF-vVDb5_jl8PivYWgTT_f3cKLvg7IMnDruCDDrICRI6WVrUT3f8ZScGKAh4ATIkYSuRqPZc=@protonmail.com> <-SP7aKgN1FZED-RAPr2FBDuCrcwnu9-UhHcRXNEsNZRwIzJXCdhVbtBP921Yn8g71d0WL7XpFRetUlBAStzRpZB8p4yj5moRS0DIE9D6cnY=@protonmail.com> <7623e2db-ba29-42f2-85df-c2e796d7305b@redhat.com> From: Jason Merrill In-Reply-To: X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Language: en-US Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-6.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: On 11/26/23 20:44, waffl3x wrote: >>>>> The other problem I'm having is >>>>> >>>>> auto f0 = [n = 5, &m](this auto const&){ n = 10; }; >>>>> This errors just fine, the lambda is unconditionally const so >>>>> LAMBDA_EXPR_MUTABLE_P flag is set for the closure. >>>>> >>>>> This on the other hand does not. The constness of the captures depends >>>>> on (I assume) LAMBDA_EXPR_MUTABLE_P so all the captures are non-const >>>>> here. >>>>> auto f1 = [n = 5](this auto&& self){ n = 10; }; >>>>> as_const(f1)(); >>>> >>>> That sounds correct, why would this be an error? >>>> >>>> The constness of the captures doesn't depend on LAMBDA_EXPR_MUTABLE_P, >>>> it depends on the type of the object parameter, which in this case is >>>> non-const, so so are the captures. >>> >>> Oops, I should have just made a less terse example, you missed the >>> "as_const" in the call to the lambda. The object parameter should be >>> deduced as const here. I definitely should have made that example >>> better, my bad. >> >> Ah, yes, I see it now. > > I don't remember if I relayed my planned fix for this to you. My > current idea is to modify the tree during instantiation of the lambda's > body somewhere near tsubst and apply const to all it's members. This is > unfortunately the best idea I have so far and it feels like an awful > hack. I am open to better ideas, but I don't think we can do anything > until the template is instantiated so I think it has to be there. I think the answer should be in lambda_proxy_type. The case where we build a DECLTYPE_TYPE may need to be expanded to cover this situation. > Should I wait until I fix the issue in tsubst_lambda_expr before > submitting the patch? I'm fine to do it either way, just whatever you > prefer. If I finish cleaning up these tests before I hear back I'll go > ahead and submit it and then start looking at different solutions in > there. Go ahead and submit. Jason