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 DFCDE3858D35 for ; Wed, 4 Jan 2023 19:05:37 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DFCDE3858D35 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=1672859137; 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=RiPaVF03i9F90GYXsNKFauMRyQ1zGDW0UR8ceayP9uY=; b=DPLqVENPZbx7lPJp86ACEEd8jluooePKQzuU6bThDMgQFZ2u18MlVE3+c5E3K7r3dKyVfM +bczuAKqFCj99wj0i6lSvS3AnE4dnVaKHPwNL8QhjoelBDnuePl5qsfDn3GZgrkpdqOCDv Ll2ZK5QCDMp2BdzilKB/CrXbaigyCEU= Received: from mail-yw1-f200.google.com (mail-yw1-f200.google.com [209.85.128.200]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-392-Wm5Jn0_CNbqYW3Gh8i489Q-1; Wed, 04 Jan 2023 14:05:30 -0500 X-MC-Unique: Wm5Jn0_CNbqYW3Gh8i489Q-1 Received: by mail-yw1-f200.google.com with SMTP id 00721157ae682-46839d9ca5dso340644297b3.16 for ; Wed, 04 Jan 2023 11:05:22 -0800 (PST) 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=RiPaVF03i9F90GYXsNKFauMRyQ1zGDW0UR8ceayP9uY=; b=iLo+rAlJluCp6D+8JbC14PU3A0xDtSUjgIcL14M2jrz5DkEecB2jUTjNLLz6ZT2hRl HiCfYI9pGfc7f4w09A+M1Iut9sFrHd35ug8DwXvCPdM7ueRBW8IIoJicLOOToGpUfUFY +VZ7SsaS2bn9R0ZATfDHakkLTk4Lmtvp2FOQjPNi9ZdCbcCgGovg6BZxfHRZDajatt08 x8ScVLa+8VoWC2Vc2ojQUUAgzUVafVWO5rEc37mdWoU3O+A++RANt3pvvIbH6AZq2z9b xidxackBk9d7tpYizsOFGe7bZuyJcUKRTzAjZO4uSSEkphg66nqNCfM+xK/811mYt4MG k8bQ== X-Gm-Message-State: AFqh2kp8kgQSTxEQg+6etSqr80Xp9U9S10aFH9L9GS/l2B60I/DdcOc6 dgWJC+LjG02PFbRi5MJLW1lIy6sAvcelfNj4H5ry0aWwvPsQ6V/jDTBPIIualFCUoJB/IubN/ta yU3vr+yzdmXiakwVcCg== X-Received: by 2002:a0d:df4e:0:b0:4ad:c248:4dac with SMTP id i75-20020a0ddf4e000000b004adc2484dacmr7040991ywe.5.1672859114435; Wed, 04 Jan 2023 11:05:14 -0800 (PST) X-Google-Smtp-Source: AMrXdXt8AiIDqjgYY8KeX4yw0upK0/Xj6n5Rl2+x0IToU06/M4QfLKOOdShrsZb/ua/OhyVBr6qMUg== X-Received: by 2002:a0d:df4e:0:b0:4ad:c248:4dac with SMTP id i75-20020a0ddf4e000000b004adc2484dacmr7040963ywe.5.1672859114105; Wed, 04 Jan 2023 11:05:14 -0800 (PST) Received: from [192.168.1.108] (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 de10-20020a05620a370a00b00704c6263924sm24272585qkb.13.2023.01.04.11.05.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Jan 2023 11:05:13 -0800 (PST) Message-ID: Date: Wed, 4 Jan 2023 14:05:12 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.6.1 Subject: Re: [PATCH] c++: mark_single_function and SFINAE [PR108282] To: Patrick Palka , gcc-patches@gcc.gnu.org References: <20230104163758.2933306-1-ppalka@redhat.com> From: Jason Merrill In-Reply-To: <20230104163758.2933306-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.3 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 1/4/23 11:37, Patrick Palka wrote: > We typically ignore mark_used failure when in a non-SFINAE context for > sake of better error recovery. But in mark_single_function we're > instead ignoring mark_used failure in a SFINAE context, which ends up > causing the second static_assert here to incorrectly fail. > > Bootstrapped and regtested on x86_64-pc-linux-gnu, does this look OK for > trunk/12? OK. > PR c++/108282 > > gcc/cp/ChangeLog: > > * decl2.cc (mark_single_function): Ignore mark_used failure > only in a non-SFINAE context rather than in a SFINAE one. > > gcc/testsuite/ChangeLog: > > * g++.dg/cpp2a/concepts-requires34.C: New test. > --- > gcc/cp/decl2.cc | 2 +- > .../g++.dg/cpp2a/concepts-requires34.C | 19 +++++++++++++++++++ > 2 files changed, 20 insertions(+), 1 deletion(-) > create mode 100644 gcc/testsuite/g++.dg/cpp2a/concepts-requires34.C > > diff --git a/gcc/cp/decl2.cc b/gcc/cp/decl2.cc > index f95529a5c9a..00ed64d1691 100644 > --- a/gcc/cp/decl2.cc > +++ b/gcc/cp/decl2.cc > @@ -5600,7 +5600,7 @@ mark_single_function (tree expr, tsubst_flags_t complain) > > if (is_overloaded_fn (expr) == 1 > && !mark_used (expr, complain) > - && (complain & tf_error)) > + && !(complain & tf_error)) > return false; > return true; > } > diff --git a/gcc/testsuite/g++.dg/cpp2a/concepts-requires34.C b/gcc/testsuite/g++.dg/cpp2a/concepts-requires34.C > new file mode 100644 > index 00000000000..670a6dab31a > --- /dev/null > +++ b/gcc/testsuite/g++.dg/cpp2a/concepts-requires34.C > @@ -0,0 +1,19 @@ > +// PR c++/108282 > +// { dg-do compile { target c++20 } } > + > +template > +concept TEST = requires { T::TT; }; > + > +struct C { }; > + > +template > +struct B { > + static inline void TT() requires TEST; > +}; > + > +int main() { > + static_assert( !TEST ); > + static_assert( !TEST> ); > + > + B::TT(); // { dg-error "no match" } > +}