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.