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 9C7FA3858C53 for ; Thu, 3 Nov 2022 15:50:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 9C7FA3858C53 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=1667490617; 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=/Ek1Y2VEVB9v3dPbaFEZ/hVHyLeNG8/kd/hEwM2hPoQ=; b=fkhiyiYM3pdiL2VrR+x4rTg+wnZcY6cIaY2svLt6Km6od/Yl2tMp1Pvm7sv8KYL1zENnb/ CbWUv2Rs51w27GTG7cnMn5nnl91EHFNOtvnLGKL1cCNqE1FHbeVqsSWcR95nTHAFKKliJ/ wcztd3jz8fZw9MVtSMUtqTwUlZQsobk= Received: from mail-qv1-f72.google.com (mail-qv1-f72.google.com [209.85.219.72]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-26-c-SAiZtBNYSqtv5NDYulZQ-1; Thu, 03 Nov 2022 11:50:15 -0400 X-MC-Unique: c-SAiZtBNYSqtv5NDYulZQ-1 Received: by mail-qv1-f72.google.com with SMTP id mi12-20020a056214558c00b004bb63393567so1543571qvb.21 for ; Thu, 03 Nov 2022 08:50:15 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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=/Ek1Y2VEVB9v3dPbaFEZ/hVHyLeNG8/kd/hEwM2hPoQ=; b=7ezLFNYRbdaaevcZWLeIsoTHIciuZDGi7C/O+lh7gdlX//PAOnRC7gOe68H9LpP/Kz i69F+Xc895sx6G+rOfA7zjjrwhzdAvHL62+a2dCV8YUHJ+K4NSaTKU5CcKdR1BV2Mugk z6cx2rQA/6cjmPrJe0Umcfcw9zbs4OjHAY4TeWQ7Yl2MA8VqY81KU+U10TAnNfVhzPEs KCyax90BotkPLdPNLnqzbSYzxQFPTJkroBUDA8sGEQcFL82AIYMAW/dnUKzWinWqd6oL nzTS84G8ppAJWHqgnoUXDqyS1xZwGGNP72eNHOz5zrrqwkKWT8zL+KQEnDWHFjpgCOUy GbtA== X-Gm-Message-State: ACrzQf1XTffp9zhfM/4Ur9tukw/WE7ks7Dwi3nBTB7Qqb8Xg1Zs2J++E 2waUn/nwGQTBjNzzh5AADT8Gj4slcWr4idwVDILFIXL1IQihl2CkRLqNdjit0M71U3YQV8OmxOc 2nP9uc8vMoJZ5ch8C0w== X-Received: by 2002:a0c:aace:0:b0:4bd:f277:26d0 with SMTP id g14-20020a0caace000000b004bdf27726d0mr3433184qvb.97.1667490614189; Thu, 03 Nov 2022 08:50:14 -0700 (PDT) X-Google-Smtp-Source: AMsMyM56MlEczRAhLs/3OnHVhGd1CsCo9smiCuFaEYGWpt6hswmfKiOY8QshPeYhuBwq1QAwMELnnw== X-Received: by 2002:a0c:aace:0:b0:4bd:f277:26d0 with SMTP id g14-20020a0caace000000b004bdf27726d0mr3433156qvb.97.1667490613881; Thu, 03 Nov 2022 08:50:13 -0700 (PDT) Received: from [192.168.1.101] (130-44-159-43.s15913.c3-0.arl-cbr1.sbo-arl.ma.cable.rcncustomer.com. [130.44.159.43]) by smtp.gmail.com with ESMTPSA id c18-20020ac85192000000b0035bafecff78sm705026qtn.74.2022.11.03.08.50.12 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Nov 2022 08:50:12 -0700 (PDT) Message-ID: <6a030b88-d66f-dc9c-9b51-19f022d3ac58@redhat.com> Date: Thu, 3 Nov 2022 11:50:12 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.4.1 Subject: Re: [PATCH] c++: constexpr error with defaulted virtual dtor [PR93413] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20221103123340.1402161-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20221103123340.1402161-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: 7bit X-Spam-Status: No, score=-13.0 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,NICE_REPLY_A,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,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 11/3/22 08:33, Patrick Palka wrote: > We're rejecting the below testcase with > > error: 'virtual constexpr Base::~Base()' used before its definition > error: 'virtual constexpr Derived::~Derived()' used before its definition > > due to an early exit added to mark_used by r181272 to defer synthesis of > virtual destructors until EOF where we can set their linkage. This makes > them effectively unusable for constexpr evaluation since that needs to > be done immediately and can't also be deferred. > > Fortunately, this early exit seems to no longer be necessary ever since > r208030 enabled us to tentatively set linkage of all defaulted virtual > destructors, including templated ones. So this patch just gets rid of > this early exit. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk? OK. > PR c++/93413 > > gcc/cp/ChangeLog: > > * decl2.cc (mark_used): Don't defer synthesis of virtual > functions. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp2a/constexpr-virtual21.C: New test. > --- > gcc/cp/decl2.cc | 8 -------- > gcc/testsuite/g++.dg/cpp2a/constexpr-virtual21.C | 10 ++++++++++ > 2 files changed, 10 insertions(+), 8 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/constexpr-virtual21.C > > diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc > index e6779268ad4..eeb59eae64f 100644 > --- a/gcc/cp/decl2.cc > +++ b/gcc/cp/decl2.cc > @@ -5788,14 +5788,6 @@ mark_used (tree decl, tsubst_flags_t complain /* = tf_warning_or_error */) > && !DECL_DEFAULTED_OUTSIDE_CLASS_P (decl) > && ! DECL_INITIAL (decl)) > { > - /* Defer virtual destructors so that thunks get the right > - linkage. */ > - if (DECL_VIRTUAL_P (decl) && !at_eof) > - { > - note_vague_linkage_fn (decl); > - return true; > - } > - > /* Remember the current location for a function we will end up > synthesizing. Then we can inform the user where it was > required in the case of error. */ > diff --git a/gcc/testsuite/g++.dg/cpp2a/constexpr-virtual21.C b/gcc/testsuite/g++.dg/cpp2a/constexpr-virtual21.C > new file mode 100644 > index 00000000000..8b70c5f538b > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp2a/constexpr-virtual21.C > @@ -0,0 +1,10 @@ > +// PR c++/93413 > +// { dg-do compile { target c++20 } } > + > +struct Base { > + virtual ~Base() = default; > +}; > +constexpr Base b; > + > +struct Derived : Base { }; > +constexpr Derived d;