[libcxx-commits] [libcxx] [libc++] Add [[nodiscard]] to static numeric limit functions (PR #83748)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Sun Mar 3 18:57:24 PST 2024


================
@@ -137,9 +137,9 @@ protected:
   typedef _Tp type;
 
   static _LIBCPP_CONSTEXPR const bool is_specialized = false;
-  _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); }
-  _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); }
-  _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type min() _NOEXCEPT { return type(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type max() _NOEXCEPT { return type(); }
+  [[nodiscard]] _LIBCPP_HIDE_FROM_ABI static _LIBCPP_CONSTEXPR type lowest() _NOEXCEPT { return type(); }
----------------
frederick-vs-ja wrote:

Perhaps we should use `_LIBCPP_NODISCARD` for modes where `[[nodiscard]]` is not supported. Ditto below.

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


More information about the libcxx-commits mailing list