Skip to content

Commit

Permalink
Fix compilation failure of regression test for nlohmann#3077 on ICPC
Browse files Browse the repository at this point in the history
  • Loading branch information
falbrechtskirchinger committed May 1, 2022
1 parent 554dfb0 commit d113f11
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
9 changes: 8 additions & 1 deletion include/nlohmann/detail/meta/type_traits.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -347,8 +347,15 @@ struct is_compatible_string_type
template<typename BasicJsonType, typename ConstructibleStringType>
struct is_constructible_string_type
{
// launder type through decltype() to fix compilation failure on ICPC
#ifdef __INTEL_COMPILER
using laundered_type = decltype(std::declval<ConstructibleStringType>());
#else
using laundered_type = ConstructibleStringType;
#endif

static constexpr auto value =
is_constructible<ConstructibleStringType,
is_constructible<laundered_type,
typename BasicJsonType::string_t>::value;
};

Expand Down
9 changes: 8 additions & 1 deletion single_include/nlohmann/json.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3482,8 +3482,15 @@ struct is_compatible_string_type
template<typename BasicJsonType, typename ConstructibleStringType>
struct is_constructible_string_type
{
// launder type through decltype() to fix compilation failure on ICPC
#ifdef __INTEL_COMPILER
using laundered_type = decltype(std::declval<ConstructibleStringType>());
#else
using laundered_type = ConstructibleStringType;
#endif

static constexpr auto value =
is_constructible<ConstructibleStringType,
is_constructible<laundered_type,
typename BasicJsonType::string_t>::value;
};

Expand Down

0 comments on commit d113f11

Please sign in to comment.