[libcxx-commits] [libcxx] [libc++] Resolve LWG4370 (PR #174062)
A. Jiang via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Dec 30 23:48:23 PST 2025
================
@@ -1414,7 +1417,10 @@ template <
enable_if_t<__is_core_convertible_v<decltype(std::declval<const _Tp&>() == std::declval<const _Up&>()), bool>,
int> = 0>
_LIBCPP_HIDE_FROM_ABI constexpr bool operator==(const _Tp& __v, const optional<_Up>& __x) {
- return static_cast<bool>(__x) ? __v == *__x : false;
+ if (__x.has_value()) {
+ return __v == *__x;
+ }
----------------
frederick-vs-ja wrote:
Oh, per [LLVM's coding guidelines](https://llvm.org/docs/CodingStandards.html#don-t-use-braces-on-simple-single-statement-bodies-of-if-else-loop-statements), we should remove the newly added braces (ditto below).
Otherwise LGTM.
https://github.com/llvm/llvm-project/pull/174062
More information about the libcxx-commits
mailing list