[Bug libstdc++/96269] [10/11 Regression] optional comparison with nullopt fails

cvs-commit at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Thu Nov 5 19:09:27 GMT 2020


https://gcc.gnu.org/bugzilla/show_bug.cgi?id=96269

--- Comment #10 from CVS Commits <cvs-commit at gcc dot gnu.org> ---
The master branch has been updated by Jonathan Wakely <redi@gcc.gnu.org>:

https://gcc.gnu.org/g:cdd2d448d8200ed5ebcb232163954367b553291e

commit r11-4753-gcdd2d448d8200ed5ebcb232163954367b553291e
Author: Jonathan Wakely <jwakely@redhat.com>
Date:   Thu Nov 5 18:36:19 2020 +0000

    libstdc++: Fix constraints on std::optional comparisons [PR 96269]

    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.


More information about the Gcc-bugs mailing list