diff --git a/cpp/src/arrow/status.cc b/cpp/src/arrow/status.cc index 7ad24781a642f..55ce3fb78d257 100644 --- a/cpp/src/arrow/status.cc +++ b/cpp/src/arrow/status.cc @@ -146,6 +146,11 @@ const std::string& Status::message() const { return ok() ? no_message : state_->msg; } +const std::shared_ptr& Status::detail() const { + static std::shared_ptr no_detail = NULLPTR; + return state_ ? state_->detail : no_detail; +} + void Status::Abort() const { Abort(std::string()); } void Status::Abort(const std::string& message) const { diff --git a/cpp/src/arrow/status.h b/cpp/src/arrow/status.h index 419174d83585d..42e8929ce0b4c 100644 --- a/cpp/src/arrow/status.h +++ b/cpp/src/arrow/status.h @@ -335,10 +335,7 @@ class ARROW_EXPORT [[nodiscard]] Status : public util::EqualityComparable& detail() const { - static std::shared_ptr no_detail = NULLPTR; - return state_ ? state_->detail : no_detail; - } + const std::shared_ptr& detail() const; /// \brief Return a new Status copying the existing status, but /// updating with the existing detail.