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 37C7D3858D28 for ; Sat, 16 Sep 2023 22:00:08 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 37C7D3858D28 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1694901607; 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: in-reply-to:in-reply-to:references:references; bh=jWWjY3Nw3JD3pwwQqF2UrfLs50wk5usgFPVcEwZMl2E=; b=arauhf7eoUEZ6qa8ZQmUV+4fN4uLTJ/DL37MhS1uYiW6kiU7q8b+4i0Q8PDocLQvY/b1/i pgfHTd2PW4PBbR/2BKmpj8loGBhOd2eS/mlE9XYr3jHks24Q0Q1OFq26v+Ke/wKAtSs38t E0hf5OabSKs64VriezBbeUo82NqLN+4= Received: from mail-qk1-f197.google.com (mail-qk1-f197.google.com [209.85.222.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-264--TTezKvYMneKF9qz77PF9w-1; Sat, 16 Sep 2023 18:00:06 -0400 X-MC-Unique: -TTezKvYMneKF9qz77PF9w-1 Received: by mail-qk1-f197.google.com with SMTP id af79cd13be357-76e57b1239eso406694785a.1 for ; Sat, 16 Sep 2023 15:00:06 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1694901606; x=1695506406; h=mime-version:references:message-id:in-reply-to:subject:cc:to:date :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=jWWjY3Nw3JD3pwwQqF2UrfLs50wk5usgFPVcEwZMl2E=; b=XllAhBmXEJrQhGEhhhvMvm4Gq21ksFERemvY/2HMLJUhjgQJDQcmRo83v4kGknmQ2c ULuW5AteOqh3hz2ksB9h0xYxitiJZjLyh8yVZ7cl6P4SXr5rCTLQ2c+3B6FPhv0oQA4B EzrpQzcLQSbjRHduV3vLd7JSPa88+3aCYF7X25xv8b2Hhb53h9gHgTrpSuiZJs46/i5+ E9dV1ZoCbiZ/Rh7IFKV4PhIhzFdY/S5bjX8G/aD7NlzGF1k8qmDNadzlqzyZN7Lpkt1C m+oqZ3KiSJ13jFKu40dXe4voqqgFkC5ml291QKAPyEb1XDfK8hBsNEJrIuFeSScjkqZQ /JBA== X-Gm-Message-State: AOJu0YyzdgbQFcuUM/eCC7YIKzCwoyclsPqfQXhELsvifIa/jgihq8Qk 6bP1z2fHPVnfUOWyvXxzLbSxXpdA6GtcBiHVxyuQL9EfIRLrVUFzM2sjFKaW+gq6O5eIUS7OXvp 5ZhZ0PPiEv1r3Sr+ymA== X-Received: by 2002:a05:620a:3906:b0:76d:b6ef:941a with SMTP id qr6-20020a05620a390600b0076db6ef941amr5983913qkn.13.1694901606069; Sat, 16 Sep 2023 15:00:06 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFK23fitntIAOY9uZJjJ5bFBNgNXS6XhydrdwOf24KyETh3/itFz+SXDpioXrb3PRxl4+FmxA== X-Received: by 2002:a05:620a:3906:b0:76d:b6ef:941a with SMTP id qr6-20020a05620a390600b0076db6ef941amr5983905qkn.13.1694901605794; Sat, 16 Sep 2023 15:00:05 -0700 (PDT) Received: from [192.168.1.130] (ool-457670bb.dyn.optonline.net. [69.118.112.187]) by smtp.gmail.com with ESMTPSA id v13-20020ae9e30d000000b0076f0744ff50sm2101750qkf.136.2023.09.16.15.00.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Sep 2023 15:00:05 -0700 (PDT) From: Patrick Palka X-Google-Original-From: Patrick Palka Date: Sat, 16 Sep 2023 18:00:04 -0400 (EDT) To: Jason Merrill cc: Patrick Palka , gcc-patches@gcc.gnu.org Subject: Re: [PATCH] c++: constness of decltype of NTTP object [PR98820] In-Reply-To: <8348062b-aeaa-56e4-71d5-c447b5b4d766@redhat.com> Message-ID: <2c31b908-2d65-e879-1093-90a3cd1a6e11@idea> References: <20230915175534.2315315-1-ppalka@redhat.com> <8348062b-aeaa-56e4-71d5-c447b5b4d766@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain; charset=US-ASCII X-Spam-Status: No, score=-7.8 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 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 Sat, 16 Sep 2023, Jason Merrill wrote: > On 9/15/23 13:55, Patrick Palka wrote: > > This corrects decltype of a (class) NTTP object as per > > [dcl.type.decltype]/1.2 and [temp.param]/6 in the type-dependent case. > > In the non-dependent case (nontype-class8.C) we resolve the decltype > > ahead of time, and finish_decltype_type already made sure to drop the > > const VIEW_CONVERT_EXPR wrapper around the TEMPLATE_PARM_INDEX. > > Hmm, seems like dropping the VIEW_CONVERT_EXPR is wrong in this case? I'm not > sure why I added that. Ah sorry, my commit message was a bit sloppy. In the non-dependent case we resolve the decltype ahead of time, in which case finish_decltype_type drops the const VIEW_CONVERT_EXPR wrapper around the TEMPLATE_PARM_INDEX, and the latter has the desired non-const type. In the type-dependent case, tsubst drops the VIEW_CONVERT_EXPR because the substituted class NTTP is the already const object created by get_template_parm_object. So finish_decltype_type at instantiation time sees the bare const object, which this patch now adds special handling for. So we need to continue dropping the VIEW_CONVERT_EXPR to handle the non-dependent case. > > Jason > >