Skip to content

Commit

Permalink
Fixing compiler problems with hpx::util::optional and GCC
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Heller committed Nov 22, 2017
1 parent 563705e commit decc278
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 27 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Expand Up @@ -1414,6 +1414,8 @@ else()
# Uninitialized variables are bad, earlier compilers issue spurious warnings
hpx_add_compile_flag_if_available(-Werror=uninitialized LANGUAGES CXX C)
hpx_add_compile_flag_if_available(-Wno-unused-local-typedefs LANGUAGES CXX C)
# -Werror=maybe-uninitialized leads to false positives.
hpx_add_compile_flag_if_available(-Wno-maybe-unitialized LANGUAGES CXX C)
endif()

# Silence warning about __sync_fetch_and_nand changing semantics
Expand Down
32 changes: 5 additions & 27 deletions hpx/util/optional.hpp
Expand Up @@ -293,15 +293,9 @@ namespace hpx { namespace util
template <typename T>
constexpr bool operator==(optional<T> const& lhs, optional<T> const& rhs)
{
if (bool(lhs) != bool(rhs))
{
return false;
}
if (!bool(lhs) && !bool(rhs))
{
return true;
}
return *lhs == *rhs;
return (bool(lhs) != bool(rhs)) ? false :
(!bool(lhs) && !bool(rhs)) ? true :
(*lhs == *rhs);
}

template <typename T>
Expand All @@ -313,15 +307,7 @@ namespace hpx { namespace util
template <typename T>
constexpr bool operator<(optional<T> const& lhs, optional<T> const& rhs)
{
if (!bool(rhs))
{
return false;
}
if (!bool(lhs))
{
return true;
}
return *rhs < *lhs;
return (!bool(rhs)) ? false : (!bool(lhs)) ? true : *rhs < *lhs;
}

template <typename T>
Expand All @@ -333,15 +319,7 @@ namespace hpx { namespace util
template <typename T>
constexpr bool operator>(optional<T> const& lhs, optional<T> const& rhs)
{
if (!bool(lhs))
{
return false;
}
if (!bool(rhs))
{
return true;
}
return *rhs > *lhs;
return (!bool(rhs)) ? false : (!bool(lhs)) ? true : *rhs > *lhs;
}

template <typename T>
Expand Down

0 comments on commit decc278

Please sign in to comment.