Commit 18de341f authored by Pádraig Brady's avatar Pádraig Brady Committed by Facebook Github Bot

folly: avoid compile warning/failure due to lvalue-to-rvalue conversion

Summary:
With gcc 7.2 we get the warning:
  folly/io/async/DelayedDestructionBase.h:252:20:
  error: parameter ‘right’ set but not used [-Werror=unused-but-set-parameter]
     std::nullptr_t right) {
                    ^~~~~
I presume this is due to the implicit conversion, hence the named parameter is
never assigned.  Instead we use an explicit nullptr.

Reviewed By: yfeldblum

Differential Revision: D6279302

fbshipit-source-id: ed449601b0410c178777f20e82ed09d9097bd024
parent b529367b
...@@ -247,25 +247,25 @@ inline bool operator !=( ...@@ -247,25 +247,25 @@ inline bool operator !=(
const DelayedDestructionBase::DestructorGuard& right) { const DelayedDestructionBase::DestructorGuard& right) {
return left.get() != right.get(); return left.get() != right.get();
} }
inline bool operator ==( inline bool operator==(
const DelayedDestructionBase::DestructorGuard& left, const DelayedDestructionBase::DestructorGuard& left,
std::nullptr_t right) { std::nullptr_t) {
return left.get() == right; return left.get() == nullptr;
} }
inline bool operator ==( inline bool operator==(
std::nullptr_t left, std::nullptr_t,
const DelayedDestructionBase::DestructorGuard& right) { const DelayedDestructionBase::DestructorGuard& right) {
return left == right.get(); return nullptr == right.get();
} }
inline bool operator !=( inline bool operator!=(
const DelayedDestructionBase::DestructorGuard& left, const DelayedDestructionBase::DestructorGuard& left,
std::nullptr_t right) { std::nullptr_t) {
return left.get() != right; return left.get() != nullptr;
} }
inline bool operator !=( inline bool operator!=(
std::nullptr_t left, std::nullptr_t,
const DelayedDestructionBase::DestructorGuard& right) { const DelayedDestructionBase::DestructorGuard& right) {
return left != right.get(); return nullptr != right.get();
} }
template <typename LeftAliasType, typename RightAliasType> template <typename LeftAliasType, typename RightAliasType>
...@@ -281,27 +281,27 @@ inline bool operator !=( ...@@ -281,27 +281,27 @@ inline bool operator !=(
return left.get() != right.get(); return left.get() != right.get();
} }
template <typename LeftAliasType> template <typename LeftAliasType>
inline bool operator ==( inline bool operator==(
const DelayedDestructionBase::IntrusivePtr<LeftAliasType>& left, const DelayedDestructionBase::IntrusivePtr<LeftAliasType>& left,
std::nullptr_t right) { std::nullptr_t) {
return left.get() == right; return left.get() == nullptr;
} }
template <typename RightAliasType> template <typename RightAliasType>
inline bool operator ==( inline bool operator==(
std::nullptr_t left, std::nullptr_t,
const DelayedDestructionBase::IntrusivePtr<RightAliasType>& right) { const DelayedDestructionBase::IntrusivePtr<RightAliasType>& right) {
return left == right.get(); return nullptr == right.get();
} }
template <typename LeftAliasType> template <typename LeftAliasType>
inline bool operator !=( inline bool operator!=(
const DelayedDestructionBase::IntrusivePtr<LeftAliasType>& left, const DelayedDestructionBase::IntrusivePtr<LeftAliasType>& left,
std::nullptr_t right) { std::nullptr_t) {
return left.get() != right; return left.get() != nullptr;
} }
template <typename RightAliasType> template <typename RightAliasType>
inline bool operator !=( inline bool operator!=(
std::nullptr_t left, std::nullptr_t,
const DelayedDestructionBase::IntrusivePtr<RightAliasType>& right) { const DelayedDestructionBase::IntrusivePtr<RightAliasType>& right) {
return left != right.get(); return nullptr != right.get();
} }
} // namespace folly } // namespace folly
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment