From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-qt1-x82d.google.com (mail-qt1-x82d.google.com [IPv6:2607:f8b0:4864:20::82d]) by sourceware.org (Postfix) with ESMTPS id 22FC23861038; Thu, 5 Nov 2020 20:12:29 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 22FC23861038 Received: by mail-qt1-x82d.google.com with SMTP id i12so2061780qtj.0; Thu, 05 Nov 2020 12:12:29 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=gXw4a55xauaj4KY73w6S2mYLluMVkxwWJ8Lsqu4kAko=; b=JwJVNsCO9ilhuV+h22hofNawFusFPxAvMzLkjSgTWBi3Ahj3gDtg6wiNGxMSe2NKCk v+gJZQ4DFO0GrMmxd5R0gwaBrO5ib1UPSyistO6l7jWI/SoXVmg2CYrAju7koI9zAusy mgH+g6tBKr6Lsd8jayYitJrGAPx72pzx9NEi85XHvP2kJyHehylG02OgWUgu+DBffwOQ JDdSVt4zFanxU/K8ImBaN1UHxBln2zAYgungOhffN6HokPNj0zv3tVD810+ASQ9IOg7G Pjy6Kdri0bxGAwtzqfITf8d47G0VkP4YRVGhMLdHOAZs4x3CROYDHQBYyI1ZpoqTCKhp Ic/Q== X-Gm-Message-State: AOAM530qbDQjaCMiVxQ6wWXY626XTgff2uSh5A0VzEo4p/r6Ps3JE/fg iDyZYoGe93v6K90B9mh+eoPs5o+AZlp3LP702VY= X-Google-Smtp-Source: ABdhPJwqp6aVfySmAmjKbKVRg2vIOo5d03llhm4uRDoABqTdGPx4iEy4oJKDLpEoIYBYwosQkenc4Gh1/3PGsTU1jFc= X-Received: by 2002:a05:622a:347:: with SMTP id r7mr3567210qtw.335.1604607148733; Thu, 05 Nov 2020 12:12:28 -0800 (PST) MIME-Version: 1.0 References: <20201105190941.GA3537038@redhat.com> <20201105195049.GI503596@redhat.com> In-Reply-To: <20201105195049.GI503596@redhat.com> From: Ville Voutilainen Date: Thu, 5 Nov 2020 22:12:17 +0200 Message-ID: Subject: Re: [committed] libstdc++: Fix constraints on std::optional comparisons [PR 96269] To: Jonathan Wakely Cc: "libstdc++" , gcc-patches List Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-3.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: libstdc++@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libstdc++ mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 05 Nov 2020 20:12:30 -0000 On Thu, 5 Nov 2020 at 21:52, Jonathan Wakely via Libstdc++ wrote: > > On 05/11/20 19:09 +0000, Jonathan Wakely wrote: > >The relational operators for std::optional were using the wrong types > >in the declval expressions used to constrain them. Instead of using > >const lvalues they were using non-const rvalues, which meant that a type > >might satisfy the constraints but then give an error when the function > >body was instantiated. > > > >libstdc++-v3/ChangeLog: > > > > PR libstdc++/96269 > > * include/std/optional (operator==, operator!=, operator<) > > (operator>, operator<=, operator>=): Fix types used in > > SFINAE constraints. > > * testsuite/20_util/optional/relops/96269.cc: New test. > > > >Tested powerpc64le-linux. Committed to trunk. > > When concepts are supported we can make the alias templates > __optional_eq_t et al use a requires-expression instead of SFINAE. > This is potentially faster to compile, given expected improvements > to C++20 compilers. > > I'm testing this patch. It concerns me that we'd have such conditional conceptifying just because it's possibly faster to compile. There's more types where we'd want to conditionally use concepts, but perhaps we want to think a bit more how to do that in our source code, rather than just make them preprocessor-conditionals in the same header. We might entertain conceptifying tuple, when concepts are available. That may end up being fairly verbose if it's done with preprocessor in . That's not to say that I'm objecting to this as such; I merely think we want to be a bit careful with conceptifying, and be rather instantly prepared to entertain doing it with a slightly different source code structure, which may involve splitting things across more files, which would then involve adding more headers that are installed.