未验证 提交 5369378b 编写于 作者: 石晓伟 提交者: GitHub

fixes a bug, test=develop (#43884)

上级 5161a047
...@@ -215,8 +215,8 @@ struct Status::Impl { ...@@ -215,8 +215,8 @@ struct Status::Impl {
std::string msg; std::string msg;
}; };
Status::Status() noexcept : impl_(new Impl) {} Status::Status() : impl_(std::make_shared<Impl>()) {}
Status::Status(const Status& status) noexcept : impl_(new Impl) { Status::Status(const Status& status) : impl_(std::make_shared<Impl>()) {
*impl_ = *status.impl_; *impl_ = *status.impl_;
} }
...@@ -224,7 +224,7 @@ Status& Status::operator=(const Status& status) noexcept { ...@@ -224,7 +224,7 @@ Status& Status::operator=(const Status& status) noexcept {
*impl_ = *status.impl_; *impl_ = *status.impl_;
return *this; return *this;
} }
Status::Status(std::exception_ptr e) noexcept : impl_(new Impl) { Status::Status(std::exception_ptr e) : impl_(std::make_shared<Impl>()) {
constexpr int kDefaultError{-1}; constexpr int kDefaultError{-1};
impl_->ec = kDefaultError; impl_->ec = kDefaultError;
try { try {
...@@ -238,7 +238,7 @@ Status::Status(std::exception_ptr e) noexcept : impl_(new Impl) { ...@@ -238,7 +238,7 @@ Status::Status(std::exception_ptr e) noexcept : impl_(new Impl) {
impl_->msg = e.what(); impl_->msg = e.what();
} }
} }
Status Status::OK() noexcept { return Status(); } Status Status::OK() { return Status(); }
bool Status::ok() const noexcept { return impl_->ec == 0; } bool Status::ok() const noexcept { return impl_->ec == 0; }
Status::Code Status::code() const noexcept { return impl_->ec; } Status::Code Status::code() const noexcept { return impl_->ec; }
const std::string& Status::error_message() const noexcept { return impl_->msg; } const std::string& Status::error_message() const noexcept { return impl_->msg; }
......
...@@ -48,10 +48,10 @@ class Status { ...@@ -48,10 +48,10 @@ class Status {
using Code = int; using Code = int;
struct Impl; struct Impl;
Status() noexcept; Status();
explicit Status(std::exception_ptr e) noexcept; explicit Status(std::exception_ptr e);
Status(const Status&) noexcept; Status(const Status&);
Status& operator=(const Status&) noexcept; Status& operator=(const Status&) noexcept;
Status& operator=(Status&&) = default; Status& operator=(Status&&) = default;
Status(Status&&) = default; Status(Status&&) = default;
...@@ -61,7 +61,7 @@ class Status { ...@@ -61,7 +61,7 @@ class Status {
/// ///
/// \return A status which indicate ok. /// \return A status which indicate ok.
/// ///
static Status OK() noexcept; static Status OK();
/// ///
/// \brief Determine whether the status is ok. /// \brief Determine whether the status is ok.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册