From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lj1-x22c.google.com (mail-lj1-x22c.google.com [IPv6:2a00:1450:4864:20::22c]) by sourceware.org (Postfix) with ESMTPS id 5F7A6398E429; Thu, 3 Jun 2021 16:25:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 5F7A6398E429 Received: by mail-lj1-x22c.google.com with SMTP id d2so3727379ljj.11; Thu, 03 Jun 2021 09:25:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=469ZjaVybqAYDiHMb6nWpeQyu0P0gPeCHmrA/ewmp2M=; b=sz4lrjWRq6dp5h0S5KSG9kLb3wFf9vXD131pYAVxfmQsUGPBcas1SNCXKlPwoC/OmK XGCI2fexscYHZq/Y2MzVOoGrbmtH4EU5i9XwVk+rt40E/D9demG5iEGXQqgPfirczVzp eT+2ewjKbYaAqRDgkwPfF6W6nVW//zSoD+VBHBe7zU1Exg3mSyenqNIn5gGvQ17POcqI vAEdN/lOLhoC/lCGLlk646pEVNgYdC0cHdg7TkdhYTUBdThCG0unygLSdyEFO/oFY1Dn jx+75TR1m9P4o1MLmqZRLG+2AeErZvaF8kE9o81KVdxU/PTw1GtVL27llZy7T/Jybnox vT5Q== X-Gm-Message-State: AOAM530N/1DWHHKMh1XwUunQhI3mipZhtgzAv6AbZowyG70DTUW8PoGj 9RxTzRsEEJlL9fPEs7M1cFQ+MnYUHz76MIm5qXUqpOCg7JcR X-Google-Smtp-Source: ABdhPJxjB3Mn+QCDqB5T3sGQdwR9MTBRr1QCxOwh1Op5BqP9YxTVVvxQsbJV/orrV1ZG/85LIj+DZjYqQC9z9d2rr64= X-Received: by 2002:a05:651c:1185:: with SMTP id w5mr139440ljo.379.1622737543780; Thu, 03 Jun 2021 09:25:43 -0700 (PDT) MIME-Version: 1.0 From: "Seija K." Date: Thu, 3 Jun 2021 12:25:30 -0400 Message-ID: Subject: [PATCH] PR libstdc++/98842: Fixed Constraints on operator<=>(optional, U) To: "gcc-patches@gcc.gnu.org" , "libstdc++@gcc.gnu.org" X-Spam-Status: No, score=-10.8 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, GIT_PATCH_0, HTML_MESSAGE, KAM_SHORT, 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 Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.29 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, 03 Jun 2021 16:25:46 -0000 The original operator was underconstrained. _Up needs to fulfill compare_three_way_result, as mentioned in this bug report https://gcc.gnu.org/bugzilla/show_bug.cgi?id=98842 diff --git a/libstdc++-v3/include/std/optional b/libstdc++-v3/include/std/optional index 8b9e038e6e510..9e61c1b2cbfbd 100644 --- a/libstdc++-v3/include/std/optional +++ b/libstdc++-v3/include/std/optional @@ -1234,7 +1234,7 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION { return !__rhs || __lhs >= *__rhs; } #ifdef __cpp_lib_three_way_comparison - template + template _Up> constexpr compare_three_way_result_t<_Tp, _Up> operator<=>(const optional<_Tp>& __x, const _Up& __v) { return bool(__x) ? *__x <=> __v : strong_ordering::less; }