Skip to content

Commit

Permalink
Make FMT_ASSERT work in constexpr on clang 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
vitaut committed Feb 26, 2020
1 parent 13d82e3 commit b2d3a86
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions include/fmt/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -259,9 +259,9 @@ FMT_API void assert_fail(const char* file, int line, const char* message);
# ifdef NDEBUG
# define FMT_ASSERT(condition, message)
# else
# define FMT_ASSERT(condition, message) \
((condition) \
? void() \
# define FMT_ASSERT(condition, message) \
((condition) /* void() fails with -Winvalid-constexpr on clang 4.0.1 */ \
? (void)0 \
: ::fmt::internal::assert_fail(__FILE__, __LINE__, (message)))
# endif
#endif
Expand Down Expand Up @@ -947,12 +947,10 @@ template <typename Context> struct arg_mapper {
map(static_cast<typename std::underlying_type<T>::type>(val))) {
return map(static_cast<typename std::underlying_type<T>::type>(val));
}
template <
typename T,
FMT_ENABLE_IF(
!is_string<T>::value && !is_char<T>::value &&
(has_formatter<T, Context>::value ||
has_fallback_formatter<T, Context>::value))>
template <typename T,
FMT_ENABLE_IF(!is_string<T>::value && !is_char<T>::value &&
(has_formatter<T, Context>::value ||
has_fallback_formatter<T, Context>::value))>
FMT_CONSTEXPR const T& map(const T& val) {
return val;
}
Expand Down

0 comments on commit b2d3a86

Please sign in to comment.