[libcxx-commits] [libcxx] [libc++][memory] Applied `[[nodiscard]]` to smart pointers (PR #168483)

Hristo Hristov via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 18 00:24:34 PST 2025


================
@@ -672,8 +675,8 @@ operator<=>(const unique_ptr<_T1, _D1>& __x, const unique_ptr<_T2, _D2>& __y) {
 #endif
 
 template <class _T1, class _D1>
-inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 bool
-operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT {
+inline _LIBCPP_HIDE_FROM_ABI
+_LIBCPP_CONSTEXPR_SINCE_CXX23 bool operator==(const unique_ptr<_T1, _D1>& __x, nullptr_t) _NOEXCEPT {
----------------
Zingam wrote:

I don't know if the warnings are enabled by default but I got warnings about unused resaults in comparisons operators when testing and adding [[nodiscard]] didn't change the warning message, also I think the library doesn't apply [[nodiscard]] to comparisons operators so I reverted the changes.

https://github.com/llvm/llvm-project/pull/168483


More information about the libcxx-commits mailing list