Skip to content

Commit

Permalink
"Fix" build on GCC part 2
Browse files Browse the repository at this point in the history
  • Loading branch information
braxtons12 committed Jan 31, 2024
1 parent 8804a36 commit 3b6f9de
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 4 deletions.
3 changes: 2 additions & 1 deletion docs/Doxyfile
Original file line number Diff line number Diff line change
Expand Up @@ -2207,7 +2207,8 @@ INCLUDE_FILE_PATTERNS =

PREDEFINED = HYPERION_PLATFORM_STD_LIB_HAS_COMPARE:=1 \
HYPERION_IGNORE_DOCUMENTATION_WARNING_START:="" \
HYPERION_IGNORE_DOCUMENTATION_WARNING_STOP:=""
HYPERION_IGNORE_DOCUMENTATION_WARNING_STOP:="" \
HYPERION_PLATFORM_COMPILER_IS_GCC:=""

# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
Expand Down
23 changes: 20 additions & 3 deletions include/hyperion/mpl/value.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,10 @@

namespace hyperion::mpl {

// this hack doesn't work w/ GCC
// TODO(braxtons12): Find a way to do this on GCC
#if !HYPERION_PLATFORM_COMPILER_IS_GCC

namespace detail {

template<typename TType, int = (TType::value, 0)>
Expand All @@ -81,6 +85,8 @@ namespace hyperion::mpl {

} // namespace detail

#endif // !HYPERION_PLATFORM_COMPILER_IS_GCC

/// @brief Concept specifying the requirements for a metaprogramming
/// value type.
///
Expand All @@ -93,7 +99,14 @@ namespace hyperion::mpl {
/// @ingroup value
/// @headerfile hyperion/mpl/value.h
template<typename TType>
concept ValueType = requires { TType::value; } && detail::HasStaticConstexprValue<TType>;
concept ValueType =
#if !HYPERION_PLATFORM_COMPILER_IS_GCC
// this hack doesn't work w/ GCC
// TODO(braxtons12): Find a way to do this on GCC
requires { TType::value; } && detail::HasStaticConstexprValue<TType>;
#else
requires { TType::value; };
#endif // !HYPERION_PLATFORM_COMPILER_IS_GCC

/// @brief Type trait to determine whether type `TType` is a metaprogramming value type.
///
Expand Down Expand Up @@ -418,7 +431,8 @@ namespace hyperion::mpl {
template<auto TValue, typename TType = decltype(TValue)>
requires concepts::BooleanNotable<TType>
[[nodiscard]] constexpr auto
operator!([[maybe_unused]] const Value<TValue, TType>& value) noexcept -> Value<!TValue, TType> {
operator!([[maybe_unused]] const Value<TValue, TType>& value) noexcept
-> Value<!TValue, TType> {
return {};
}

Expand Down Expand Up @@ -486,7 +500,8 @@ namespace hyperion::mpl {
template<auto TValue, typename TType = decltype(TValue)>
requires concepts::BinaryNotable<TType>
[[nodiscard]] constexpr auto
operator~([[maybe_unused]] const Value<TValue, TType>& value) noexcept -> Value<~TValue, TType> {
operator~([[maybe_unused]] const Value<TValue, TType>& value) noexcept
-> Value<~TValue, TType> {
return {};
}

Expand Down Expand Up @@ -588,9 +603,11 @@ namespace hyperion::mpl {
static_assert(ValueType<std::bool_constant<true>>,
"hyperion::mpl::ValueType not satisfied by std::bool_constant "
"(implementation failing)");
#if !HYPERION_PLATFORM_COMPILER_IS_GCC
static_assert(!ValueType<not_value_type>,
"hyperion::mpl::ValueType not satisfied by _test::not_value_type "
"(implementation failing)");
#endif // !HYPERION_PLATFORM_COMPILER_IS_GCC

static_assert(value_of(Value<3>{}) == 3, "hyperion::mpl::value_of test case 1 (failing)");
static_assert(value_of(std::integral_constant<int, 3>{}) == 3,
Expand Down

0 comments on commit 3b6f9de

Please sign in to comment.