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.129.124]) by sourceware.org (Postfix) with ESMTPS id 3D67F3858D33 for ; Sun, 19 Nov 2023 16:31:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 3D67F3858D33 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 3D67F3858D33 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.129.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700411514; cv=none; b=oRvuaqdhLisRUyjqohRL0JOxf88mQCAI9S28B4dF5YxFhQt74U3T0ln6T0qFXBBBoh1TNf9BySXDchJRwbqPwqUs6/5C2eYgTL+ggFGfJbhHbE2xI/G+Qd5CbFkoJERB2NqoQQ6DNcKZn4DNtMwCQpWBqoNyoI1MvIHpTixPkZc= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1700411514; c=relaxed/simple; bh=0zRX8Gy7YCFd1AT9pz6BLiXy981hZhyMw+Lr1chzZns=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=wChf5gz/stc8JlPOrBBHfsv/f5SZ7Oo+pcTqjzly0PcyoIf7pz+Jukh6nWxkGwrwxHaFDu2gj3Sf5UKFxM6iTJcRnjZWx+6y+5mL0uL2TQqLFHPkeW+4Ad3vKtCOUFg572kffi5/KtYZ6XozEoiDpz5z8xDJyrlvtw5ox2sP0tw= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1700411512; 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=yEMPRmf/gUCMi4KZ9wupXC3gU7taMmxWWgYjeAdgLSA=; b=GEdyAVtG3NVm3Lufx6sNaWOlCCr6IncHqOVEj0OSuXHnGS9HcnaYBD3IkyIWwG+dgeZ/zR VJg1DsJZFOFOC1Zcc95p847BMNmSIbKNuvLECFzKrAzE1vhI8An8uI0aECHvrhTMLZy3Ve zBB6jVDyktPGIxefCEu4Me/CmcXRv2Y= Received: from mail-qk1-f200.google.com (mail-qk1-f200.google.com [209.85.222.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-341-v32pIUAZNCefUo_BG_cGDw-1; Sun, 19 Nov 2023 11:31:50 -0500 X-MC-Unique: v32pIUAZNCefUo_BG_cGDw-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-77a033cbd96so381044985a.2 for ; Sun, 19 Nov 2023 08:31:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1700411510; x=1701016310; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=yEMPRmf/gUCMi4KZ9wupXC3gU7taMmxWWgYjeAdgLSA=; b=u6LN11REKAYhXAqZgdpc4GCokjuFuUP9uN56tfsBCngncjeUVbLu/OJ/rtDlxckvPO i1L69BeknFlTBM+4H9OZuobbWupLwRVRE7hAbSWeYuuPnljRfpoyI88fawPRdscyL+WS c70LTDHdM4gNbHaIiNnSjeV0o/bQO4Ub9p96QpeSoNYGceDItZGC0UGUUnkTs1BITiMp JWTCoxHQjjMf7OBggBasYv0G+dj/j+nIsPCLfNv8gh/+5mxeh/mMeTCA2UQSUsKPXPKJ 0U1EPzTR/6zM7rc0TH8GbrajIeJWpJv0K/ZSre0h7yO8+rjCENIecHz4SibMrxT0+KB2 JjeA== X-Gm-Message-State: AOJu0YyxROUwf3PvyXf14Lm8wa2CBIcB32Gx9PjdRvxOxx6//7X8447s 3HZR6dLYolDOVYUh4owHcbdyea+UUrmMIBG0+2wBB7U+ed3jdqfRm9d9R/+mhTYxBxnebRTjie6 5yQwD9ocjQmETwUpFvw== X-Received: by 2002:a05:620a:ed2:b0:77a:3f9:ee22 with SMTP id x18-20020a05620a0ed200b0077a03f9ee22mr3459251qkm.4.1700411510388; Sun, 19 Nov 2023 08:31:50 -0800 (PST) X-Google-Smtp-Source: AGHT+IFIqHZlUzTENvg+jZVlEbncklIxoU21iwodyrgGo4NH3MQ9oKNrQ3kP0e49LA8j0mZNBLRSXw== X-Received: by 2002:a05:620a:ed2:b0:77a:3f9:ee22 with SMTP id x18-20020a05620a0ed200b0077a03f9ee22mr3459236qkm.4.1700411510030; Sun, 19 Nov 2023 08:31:50 -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 vv24-20020a05620a563800b0076cda7eab11sm2014011qkn.133.2023.11.19.08.31.48 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 19 Nov 2023 08:31:49 -0800 (PST) Message-ID: Date: Sun, 19 Nov 2023 11:31:48 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v3 1/2] c++: Initial support for P0847R7 (Deducing This) [PR102609] To: waffl3x Cc: "gcc-patches@gcc.gnu.org" References: <00094736-8325-4c83-9237-a6c15c324c24@redhat.com> <3tSXKK_P5IpLLm2VJ76q-eiLPZhiaC6_ZpwOrej22LWsmGA_YXipLXwLdLNeFlShJaqpFH_LPQW6tqkPD1WlFnExnL-iDoW9CoA-KQETWYw=@protonmail.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.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,KAM_SHORT,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,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/19/23 08:39, waffl3x wrote: > Funny enough I ended up removing the ones I was thinking about, seems > to always happen when I ask style questions but I'm glad to hear it's > okay going forward. > > I'm having trouble fixing this bug, based on what Gasper said in > PR102609 I am pretty sure I know what the semantics should be. Since > the capture is not used in the body of the function, it should be well > formed to call the function with an unrelated type. I don't think so: https://eel.is/c++draft/expr.prim#lambda.closure-5 says the type of the xobj parameter must be related. > I had begun trying to tackle the case that Gasper mentioned and got the > following ICE. I also have another case that ICEs so I've been thinking > I don't get to do little changes to fix this. I've been looking at this > for a few hours now and given we are past the deadline now I figured I > should see what others think. > > int main() > { > int x = 42; > auto f1 = [x](this auto&& self) {}; > > static_cast(decltype(f1)::operator()); > } This should be rejected when we try to instantiate the op() with int. > As I said, there is also this case that also ICEs in the same region. > It's making me think that some core assumptions are being violated in > the code leading up to finish_non_static_data_member. > > int main() > { > int x = 42; > auto f1 = [x](this auto self) {}; > } Here I think the problem is in build_capture_proxy: > /* The proxy variable forwards to the capture field. */ > object = build_fold_indirect_ref (DECL_ARGUMENTS (fn)); > object = finish_non_static_data_member (member, object, NULL_TREE); The call to build_fold_indirect_ref assumes that 'this' is a pointer, which it is not here. I think you can just make that conditional on it being a pointer or reference? Jason