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 4244F3858C54 for ; Wed, 7 Jun 2023 21:00:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 4244F3858C54 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=1686171644; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=YrJyJRHrqgqVezFXGS5wsGFK7XmmTUfOMVrwYRqBC6c=; b=Pq9iOJPnfvaV+5k3KMdVORGiQ8yxOR/siWFqVyI8hiy2JqpvpHVrzWSFZcwWVj/QHxUpzP kQSOI2yNSgb7LMr7Kr9a3LFNcagOlaVvyFQMdtlllqlGUGB4G7q4pJFG26qgbWKXv7jDke jP+ZujR8uid2Vn41OL6z25WCE7CBquU= 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-631-iycWMY3FNZ2G6Hq2etl4nQ-1; Wed, 07 Jun 2023 17:00:43 -0400 X-MC-Unique: iycWMY3FNZ2G6Hq2etl4nQ-1 Received: by mail-qk1-f200.google.com with SMTP id af79cd13be357-75e51352f41so435550285a.2 for ; Wed, 07 Jun 2023 14:00:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686171643; x=1688763643; h=content-transfer-encoding:in-reply-to:from:references: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=YrJyJRHrqgqVezFXGS5wsGFK7XmmTUfOMVrwYRqBC6c=; b=jio2Xbm6NPUEE9DO3rQeCng+o16eWDl8rOK9GZxqP5tlLJHyeiUuzAqNeEgUaiElcM 86QiVUL0VfeXeuszDwpIK1y6QOUvrutMCzWpMmEeOzYjInLGptA97ZIT7yxwVPByz/8i 4jzK//wk2E+vTTThRSnEO9y1YqW0zTBGYgMklwCBmx1SdxsRVxg+5RpzC2N2U6kO9/7J te1V0a3cZjl4FqaxOkvM3O8rphLUVWG7MdUBEdUh+BdgkVe2ZqlqeWDTGqsbBXWaIzfn zIjQLYlVc8ktKjYE/vxScSzXzmNyWt2lBhEBYSWn/+bASlEl8vhCpJ2ylrGWafM77rQd Iq7w== X-Gm-Message-State: AC+VfDzlSz/4xvAz2BxaPJ3o6WeFnOzdEPDRpowW+v520y0oacU51jkX ZG+V82yUWSdQMPtrg0HLqqoOq2foXnZ6YJ01WVThFrVfwRUO/xUthRt12YFF6nzL3Fw5Jtq6Jn5 SbvSAkgXGMVnUHAJGpLTxPmrecQ== X-Received: by 2002:a05:620a:84c7:b0:75b:23a1:3fe with SMTP id pq7-20020a05620a84c700b0075b23a103femr3071747qkn.20.1686171642835; Wed, 07 Jun 2023 14:00:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4AVrP+9+APzJtYidTJca9vHDIOEKGXCVNe8wKVhAyDmwuZIgX6ikVKA2d7JFW1yrBkaQ51gg== X-Received: by 2002:a05:620a:84c7:b0:75b:23a1:3fe with SMTP id pq7-20020a05620a84c700b0075b23a103femr3071729qkn.20.1686171642504; Wed, 07 Jun 2023 14:00:42 -0700 (PDT) Received: from [192.168.1.108] (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 z10-20020ae9c10a000000b0074e0951c7e7sm186744qki.28.2023.06.07.14.00.41 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 07 Jun 2023 14:00:41 -0700 (PDT) Message-ID: <08e1b0b9-e2bd-1fb0-30a4-4ef3397631bc@redhat.com> Date: Wed, 7 Jun 2023 17:00:41 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.2 Subject: Re: [PATCH] c++: unsynthesized defaulted constexpr fn [PR110122] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20230606182953.815966-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20230606182953.815966-1-ppalka@redhat.com> 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: 8bit X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,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 6/6/23 14:29, Patrick Palka wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? > > -- >8 -- > > In the second testcase of PR110122, during regeneration of the generic > lambda with V=Bar{}, substitution followed by coerce_template_parms for > A's template argument naturally yields a copy of V in terms of Bar's > (implicitly) defaulted copy constructor. > > This however happens inside a template context so although we introduced > a use of the copy constructor, mark_used didn't actually synthesize it, > which causes subsequent constant evaluation of the template argument to > fail with: > > nontype-class58.C: In instantiation of ‘void f() [with Bar V = Bar{Foo()}]’: > nontype-class58.C:22:11: required from here > nontype-class58.C:18:18: error: ‘constexpr Bar::Bar(const Bar&)’ used before its definition > > Conveniently we already make sure to instantiate eligible constexpr > functions before such (manifestly) constant evaluation, as per P0859R0. > So this patch fixes this by making sure to synthesize eligible defaulted > constexpr functions beforehand as well. We probably also want to do this in cxx_eval_call_expression, under > /* We can't defer instantiating the function any longer. */ Jason