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 DC8EC3858412 for ; Thu, 29 Jun 2023 17:43:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DC8EC3858412 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=1688060624; 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=8/iHHCwBQdbQ18HHZt8ROYll/iGXXAa3o88Bc3TfIew=; b=Nk+ax8TAUwuGThoZyJdupuHPNW2buN/nCqan0WDFMC+ALBgPW8juyGwfIJKKTYJyICmZ02 a1Xon2bEcan8nfUVwvoBU+nWiT/PpVHP5thsXRcweeHQTKZah+CGRRGrwat9tx78zbZeqc hiI3eJhYDznGKu8rYO4bgfbzP2p2wF4= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-597-3V611-lPO0Kkyl8rYLvdmw-1; Thu, 29 Jun 2023 13:43:43 -0400 X-MC-Unique: 3V611-lPO0Kkyl8rYLvdmw-1 Received: by mail-qt1-f199.google.com with SMTP id d75a77b69052e-40328438392so11005161cf.3 for ; Thu, 29 Jun 2023 10:43:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688060622; x=1690652622; 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=8/iHHCwBQdbQ18HHZt8ROYll/iGXXAa3o88Bc3TfIew=; b=WcmqpHf2jey+gmHPIw7OmLhfgOGtk3QyMpK7+/wo/l++MrrdS9SVjMQ3hBHEikSfkQ OOF3zER9EtCmpRzdELSv+1wze3Lz18fzyeEUZLXCFajTLAG3KfmHy+J7nFh+1aDvI7+O G2mrgIWpcTuXRY2exrbrMborMdFCsYsnjaAty4UOjwXa6G4UTCXjM5uuIEyxWPMdSNZm fSMff7jvreeVAah09YfctQhbZ5kHqmsJYnVHNsV96Ia0oiacEKY94ur5E2lKAeHKUI2L yEpN+6wzp+3kd6OzBjAl4BYguMzqOf2+/cJAyh4V5wHaau/nC9eXmQKZhn6mpSvChPv0 KHXQ== X-Gm-Message-State: AC+VfDwKQbh9AiNtC/f4OYQr2t6yfvhNhQq8KvyeCNEy/ssFyqvyfgF6 itSTIUzpeDYUjHzvSogKOD7tm44gl1JIwPGLgniAoN6FbjI7P1SdIpNKOy4JXB68BGJTmn2rBkN Tncr5vUSwOoV06nndZA== X-Received: by 2002:ac8:7f52:0:b0:3ff:23e4:40b4 with SMTP id g18-20020ac87f52000000b003ff23e440b4mr117256qtk.42.1688060622582; Thu, 29 Jun 2023 10:43:42 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ6MzTdJnpWT90tpiBaIHyyEvY4LguCzwntRbjdYudGep56w+0zKYc92d9WXGAODVlUfXZwHQg== X-Received: by 2002:ac8:7f52:0:b0:3ff:23e4:40b4 with SMTP id g18-20020ac87f52000000b003ff23e440b4mr117247qtk.42.1688060622302; Thu, 29 Jun 2023 10:43: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 cc23-20020a05622a411700b003f7fd3ce69fsm4380798qtb.59.2023.06.29.10.43.40 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 29 Jun 2023 10:43:41 -0700 (PDT) Message-ID: <4dfffcf6-4a72-eb33-8362-2ab99c468d4c@redhat.com> Date: Thu, 29 Jun 2023 13:43:40 -0400 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH] c++: NSDMI instantiation during overload resolution [PR110468] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20230629152247.3838584-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20230629152247.3838584-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=-12.7 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_H5,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 6/29/23 11:22, Patrick Palka wrote: > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk/13/12? OK. > -- >8 -- > > Here we find ourselves instantiating the NSDMI for A<1>::m when > computing argument conversions during overload resolution, and > thus tf_conv is set. This causes mark_used for the constructor > used in the NSDMI to exit early and not instantiate its noexcept-spec, > leading to an ICE from nothrow_spec_p. > > This patch fixes this by clearing any unusual tsubst flags during > instantiation of an NSDMI, since the result should be independent of > the context that requires the instantiation. > > PR c++/110468 > > gcc/cp/ChangeLog: > > * init.cc (maybe_instantiate_nsdmi_init): Mask out all > tsubst flags except for tf_warning_or_error. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp0x/noexcept79.C: New test. > --- > gcc/cp/init.cc | 4 ++++ > gcc/testsuite/g++.dg/cpp0x/noexcept79.C | 18 ++++++++++++++++++ > 2 files changed, 22 insertions(+) > create mode 100644 gcc/testsuite/g++.dg/cpp0x/noexcept79.C > > diff --git a/gcc/cp/init.cc b/gcc/cp/init.cc > index af6e30f511e..f01a11c5299 100644 > --- a/gcc/cp/init.cc > +++ b/gcc/cp/init.cc > @@ -579,6 +579,10 @@ maybe_instantiate_nsdmi_init (tree member, tsubst_flags_t complain) > /* tsubst_decl uses void_node to indicate an uninstantiated DMI. */ > if (init == void_node) > { > + /* The result of NSDMI instantiation should be independent of > + the tsubst flags we're given. */ > + complain &= tf_warning_or_error; > + > init = DECL_INITIAL (DECL_TI_TEMPLATE (member)); > location_t expr_loc > = cp_expr_loc_or_loc (init, DECL_SOURCE_LOCATION (member)); > diff --git a/gcc/testsuite/g++.dg/cpp0x/noexcept79.C b/gcc/testsuite/g++.dg/cpp0x/noexcept79.C > new file mode 100644 > index 00000000000..d1f54d14431 > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp0x/noexcept79.C > @@ -0,0 +1,18 @@ > +// PR c++/110468 > +// { dg-do compile { target c++11 } } > + > +template > +struct variant { > + variant() noexcept(T > 0); > +}; > + > +template > +struct A { > + variant m = {}; > +}; > + > +struct B { > + B(A<1>); > +}; > + > +B b = {{}};