From 5369378ba74efb99b44c245fd8097b159615234f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=9F=B3=E6=99=93=E4=BC=9F?= <39303645+Shixiaowei02@users.noreply.github.com> Date: Tue, 28 Jun 2022 15:13:33 +0800 Subject: [PATCH] fixes a bug, test=develop (#43884) --- paddle/fluid/inference/api/paddle_infer_contrib.cc | 8 ++++---- paddle/fluid/inference/api/paddle_infer_contrib.h | 8 ++++---- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/paddle/fluid/inference/api/paddle_infer_contrib.cc b/paddle/fluid/inference/api/paddle_infer_contrib.cc index 0d17e7ca6c..171db0807e 100644 --- a/paddle/fluid/inference/api/paddle_infer_contrib.cc +++ b/paddle/fluid/inference/api/paddle_infer_contrib.cc @@ -215,8 +215,8 @@ struct Status::Impl { std::string msg; }; -Status::Status() noexcept : impl_(new Impl) {} -Status::Status(const Status& status) noexcept : impl_(new Impl) { +Status::Status() : impl_(std::make_shared()) {} +Status::Status(const Status& status) : impl_(std::make_shared()) { *impl_ = *status.impl_; } @@ -224,7 +224,7 @@ Status& Status::operator=(const Status& status) noexcept { *impl_ = *status.impl_; return *this; } -Status::Status(std::exception_ptr e) noexcept : impl_(new Impl) { +Status::Status(std::exception_ptr e) : impl_(std::make_shared()) { constexpr int kDefaultError{-1}; impl_->ec = kDefaultError; try { @@ -238,7 +238,7 @@ Status::Status(std::exception_ptr e) noexcept : impl_(new Impl) { impl_->msg = e.what(); } } -Status Status::OK() noexcept { return Status(); } +Status Status::OK() { return Status(); } bool Status::ok() const noexcept { return impl_->ec == 0; } Status::Code Status::code() const noexcept { return impl_->ec; } const std::string& Status::error_message() const noexcept { return impl_->msg; } diff --git a/paddle/fluid/inference/api/paddle_infer_contrib.h b/paddle/fluid/inference/api/paddle_infer_contrib.h index b0611dfe75..2598d5cd2d 100644 --- a/paddle/fluid/inference/api/paddle_infer_contrib.h +++ b/paddle/fluid/inference/api/paddle_infer_contrib.h @@ -48,10 +48,10 @@ class Status { using Code = int; struct Impl; - Status() noexcept; - explicit Status(std::exception_ptr e) noexcept; + Status(); + explicit Status(std::exception_ptr e); - Status(const Status&) noexcept; + Status(const Status&); Status& operator=(const Status&) noexcept; Status& operator=(Status&&) = default; Status(Status&&) = default; @@ -61,7 +61,7 @@ class Status { /// /// \return A status which indicate ok. /// - static Status OK() noexcept; + static Status OK(); /// /// \brief Determine whether the status is ok. -- GitLab