diff --git a/tsl/platform/refcount.h b/tsl/platform/refcount.h index 348ba3fe1..809078dd9 100644 --- a/tsl/platform/refcount.h +++ b/tsl/platform/refcount.h @@ -88,7 +88,7 @@ class RefCountPtr; // Adds a new reference to a RefCounted pointer. template -ABSL_MUST_USE_RESULT RefCountPtr GetNewRef(T* ptr) { +[[nodiscard]] RefCountPtr GetNewRef(T* ptr) { static_assert(std::is_base_of::value); if (ptr == nullptr) return RefCountPtr(); @@ -103,7 +103,7 @@ class ABSL_NULLABILITY_COMPATIBLE RefCountPtr : public std::unique_ptr { public: using std::unique_ptr::unique_ptr; - ABSL_MUST_USE_RESULT RefCountPtr GetNewRef() const { + [[nodiscard]] RefCountPtr GetNewRef() const { if (this->get() == nullptr) return RefCountPtr(); this->get()->Ref(); return RefCountPtr(this->get());