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 67076385770F for ; Fri, 16 Feb 2024 20:48:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 67076385770F 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 67076385770F 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=1708116526; cv=none; b=tSRRM22Cir+DxEvObzi4TczTrX1PALchMGyFqd/IbRyxK+V9f6aKYK/oFw/wHP2o1T17HLnSeAaNl3sEQTuRFA3NLUljA6s9chvgViN/bi2ZGjclRZCaWAqq7fJi3EjeGkmzK/eevcumX4CnX2cJSLWC/jl/uvPHcnfEcMtZ1pk= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1708116526; c=relaxed/simple; bh=ysRG7lzSrUNCMxPyXOu0ERx7Ygc25B26MZi75LD10sg=; h=DKIM-Signature:Message-ID:Date:MIME-Version:Subject:To:From; b=hlb+DqMxJVwHTyUAfPVg1NRAZbdrIcCFLvvzH0S+IIOgssZxsi+xqoIVa9PFgi+R9rpGVHEznO3srccLgkTwAIJsgC/zzNQSSU88loA/2+Y/V8rddsa247Q0NN6Oaa9+zZih/no6OtihtOHPdOTvkxsbGrz7P9G/YtwbRAbRGM8= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1708116524; 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=U2kR9SoL6DQ13aA/02Kijg78g2YTKZdXK/xaAsuCf4A=; b=YP851EYUdaUGhy+j6nGbtW93QCMsHUcEVryvTMozwo+PYQuQbF6o7foHLdh8zb/F89YKlE VMsfhG+GHA1GKNkzSMqWd510G5Ta82Sqt8mvCZZYGpUz88koFEiZETNUdCaFZqiCVcjB1p tHMhdZGhEnJ6lO7h3r3pV1HtFBhuyQU= Received: from mail-qt1-f198.google.com (mail-qt1-f198.google.com [209.85.160.198]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-284-DLqNSSLkNOapWOGoGnZ7Eg-1; Fri, 16 Feb 2024 15:48:42 -0500 X-MC-Unique: DLqNSSLkNOapWOGoGnZ7Eg-1 Received: by mail-qt1-f198.google.com with SMTP id d75a77b69052e-4297db4eba1so12102641cf.2 for ; Fri, 16 Feb 2024 12:48:42 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1708116522; x=1708721322; 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=U2kR9SoL6DQ13aA/02Kijg78g2YTKZdXK/xaAsuCf4A=; b=S54gvfdYqL6kCDhobuh1JW0u4x9ohE2hJ8BU+m5RO/XXvNWxQQJh2sjC0xDzDvPYC8 W4zdFJwGc2UR3yins6HEtkGNqYO9F6GPx7iONhsx75aNNJg3miozECvzmfHP9sNGAoym ce6eyYTfjk/lZ4E2ey17BOHfDkBdPf96JCadVJQ+wapj7eIHtsxUu3H8uCanbGXhV3kA bF4P3oh+dLX6y14Z3rxzrg1WP9mniqJlVMkcLZIIasQWF4P7HwX1zQj8Wkwas0Seew+g H8yBoHJa7mp9h3UfYX08cmXmnPdhsWv6USAsHtrUeVb1saF68QUpcLB83SpXtPNnfN5e S/Mw== X-Forwarded-Encrypted: i=1; AJvYcCUbRJhVzEtfgKtDBYHYRvFBiAUkmzrqjGo+6uo3b6pWaoWDk+EhKGWb7qQMRktoaAH+jvq7sQH+aCJcPITUmmI1vt0Wt2U3Nw== X-Gm-Message-State: AOJu0YxIvzqNE6+K6gy5bkFA3nyKv4ann9NIovKOpM311NozZvI/rJiF ft9GLiTtNIsFCrQOCv8fFAT3jvFPtGfxb/s7W1AjILoOAV/9kZGYkTo51jJ6qs+nxonJOmQ1oAp rFpF395L5fxjyudT7QdqIg9G6O1iPmuoSGAS5sbEWudTwWihC41L/P5btb42kimg= X-Received: by 2002:ac8:5dc9:0:b0:42c:75f:285a with SMTP id e9-20020ac85dc9000000b0042c075f285amr7282891qtx.20.1708116521938; Fri, 16 Feb 2024 12:48:41 -0800 (PST) X-Google-Smtp-Source: AGHT+IHJOmwa8U5BASfT02hX0PbBNwnAW4DZVGvhQ9o21Wp2aMVLjochozBA+wLG9fhcuhA4Zfq6qQ== X-Received: by 2002:ac8:5dc9:0:b0:42c:75f:285a with SMTP id e9-20020ac85dc9000000b0042c075f285amr7282878qtx.20.1708116521621; Fri, 16 Feb 2024 12:48:41 -0800 (PST) Received: from [192.168.1.130] (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 o19-20020ac87c53000000b0042c723627a4sm259519qtv.24.2024.02.16.12.48.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 16 Feb 2024 12:48:41 -0800 (PST) Message-ID: <8954a4c1-235e-454e-ac3a-6968b1463fd0@redhat.com> Date: Fri, 16 Feb 2024 15:48:40 -0500 MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] c++: wrong looser exception spec with deleted fn To: Marek Polacek , GCC Patches References: <20240215221654.646716-1-polacek@redhat.com> From: Jason Merrill In-Reply-To: <20240215221654.646716-1-polacek@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=-11.7 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H4,RCVD_IN_MSPIKE_WL,RCVD_IN_SORBS_WEB,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 2/15/24 17:16, Marek Polacek wrote: > Bootstrapped/regtested on x86_64-pc-linux-gnu, ok for trunk? > > IMHO trivial enough to go ahead now seeing as it doesn't introduce > new errors. OK. > -- >8 -- > I noticed we don't implement the "unless the overriding function is > defined as deleted" wording added to [except.spec] via CWG 1351. > > DR 1351 > > gcc/cp/ChangeLog: > > * search.cc (maybe_check_overriding_exception_spec): Don't error about > a looser exception specification if the overrider is deleted. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp0x/noexcept82.C: New test. > --- > gcc/cp/search.cc | 11 +++++++++-- > gcc/testsuite/g++.dg/cpp0x/noexcept82.C | 14 ++++++++++++++ > 2 files changed, 23 insertions(+), 2 deletions(-) > create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept82.C > > diff --git a/gcc/cp/search.cc b/gcc/cp/search.cc > index 2b4ed5d024e..c948839dc53 100644 > --- a/gcc/cp/search.cc > +++ b/gcc/cp/search.cc > @@ -1949,7 +1949,11 @@ locate_field_accessor (tree basetype_path, tree field_decl, bool const_p) > } > > /* Check throw specifier of OVERRIDER is at least as strict as > - the one of BASEFN. */ > + the one of BASEFN. This is due to [except.spec]: "If a virtual function > + has a non-throwing exception specification, all declarations, including > + the definition, of any function that overrides that virtual function in > + any derived class shall have a non-throwing exception specification, > + unless the overriding function is defined as deleted." */ > > bool > maybe_check_overriding_exception_spec (tree overrider, tree basefn) > @@ -1959,7 +1963,10 @@ maybe_check_overriding_exception_spec (tree overrider, tree basefn) > tree base_throw = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (basefn)); > tree over_throw = TYPE_RAISES_EXCEPTIONS (TREE_TYPE (overrider)); > > - if (DECL_INVALID_OVERRIDER_P (overrider)) > + if (DECL_INVALID_OVERRIDER_P (overrider) > + /* CWG 1351 added the "unless the overriding function is defined as > + deleted" wording. */ > + || DECL_DELETED_FN (overrider)) > return true; > > /* Can't check this yet. Pretend this is fine and let > diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept82.C b/gcc/testsuite/g++.dg/cpp0x/noexcept82.C > new file mode 100644 > index 00000000000..c996613139b > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept82.C > @@ -0,0 +1,14 @@ > +// DR 1351, Problems with implicitly-declared exception-specifications > +// { dg-do compile { target c++11 } } > + > +struct B { > + virtual void f() noexcept; > + virtual void g(); > + virtual void h() noexcept = delete; > +}; > + > +struct D: B { > + void f(); // { dg-error "looser" } > + void g() noexcept; // OK > + void h() = delete; // OK > +}; > > base-commit: 0d5d1c75f5c68b6064640c3154ae5f4c0b464905