From b85c9ee6fb9b421759b8754e613a1ebb3caba9e4 Mon Sep 17 00:00:00 2001 From: Jan Beich Date: Fri, 24 Aug 2018 09:34:29 +0000 Subject: [PATCH] games/nxengine: unbreak with libc++ 7 In file included from src/i18n/translate.cpp:2: src/i18n/../common/json.hpp:1379:9: error: static_assert failed "could not find from_json() method in T's namespace" static_assert(sizeof(BasicJsonType) == 0, ^ ~~~~~~~~~~~~~~~~~~~~~~~~~~ src/i18n/../common/json.hpp:1388:16: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::call, bool, long, unsigned long, double, std::allocator, adl_serializer>, std::__1::basic_string_view > >' requested here return call(j, val, priority_tag<1> {}); ^ src/i18n/../common/json.hpp:6860:9: note: in instantiation of function template specialization 'nlohmann::detail::from_json_fn::operator(), bool, long, unsigned long, double, std::allocator, adl_serializer>, std::__1::basic_string_view > >' requested here ::nlohmann::from_json(std::forward(j), val); ^ src/i18n/../common/json.hpp:9579:36: note: in instantiation of function template specialization 'nlohmann::adl_serializer >, void>::from_json, bool, long, unsigned long, double, std::allocator, adl_serializer> &, std::__1::basic_string_view > >' requested here JSONSerializer::from_json(*this, ret); ^ src/i18n/../common/json.hpp:9842:16: note: in instantiation of function template specialization 'nlohmann::basic_json, bool, long, unsigned long, double, std::allocator, adl_serializer>::get >, std::__1::basic_string_view >, 0>' requested here return get(); ^ /usr/include/c++/v1/string:875:29: note: in instantiation of function template specialization 'nlohmann::basic_json, bool, long, unsigned long, double, std::allocator, adl_serializer>::operator basic_string_view >, 0>' requested here {__self_view __sv = __t; return assign(__sv);} ^ src/i18n/translate.cpp:22:34: note: in instantiation of function template specialization 'std::__1::basic_string, std::__1::allocator >::operator=, bool, long, unsigned long, double, std::allocator, adl_serializer>, void>' requested here _strings[ it.key() ] = it.value(); ^ PR: 230630 Obtained from: upstream (json-3.2.0) Approved by: portmgr blanket --- games/nxengine/files/patch-libc++7 | 63 ++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 games/nxengine/files/patch-libc++7 diff --git a/games/nxengine/files/patch-libc++7 b/games/nxengine/files/patch-libc++7 new file mode 100644 index 000000000000..f50b04c91d75 --- /dev/null +++ b/games/nxengine/files/patch-libc++7 @@ -0,0 +1,63 @@ +https://github.com/nlohmann/json/commit/8165707990e4 + +--- src/common/json.hpp.orig 2018-04-09 20:44:59 UTC ++++ src/common/json.hpp +@@ -840,6 +840,16 @@ struct is_compatible_object_type_impl::value; + }; + ++template ++struct is_compatible_string_type_impl : std::false_type {}; ++ ++template ++struct is_compatible_string_type_impl ++{ ++ static constexpr auto value = ++ std::is_same::value; ++}; ++ + template + struct is_compatible_object_type + { +@@ -850,6 +860,15 @@ struct is_compatible_object_type + typename BasicJsonType::object_t, CompatibleObjectType >::value; + }; + ++template ++struct is_compatible_string_type ++{ ++ static auto constexpr value = is_compatible_string_type_impl < ++ conjunction>, ++ has_value_type>::value, ++ typename BasicJsonType::string_t, CompatibleStringType >::value; ++}; ++ + template + struct is_basic_json_nested_type + { +@@ -1132,6 +1151,25 @@ void from_json(const BasicJsonType& j, typename BasicJ + { + JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()))); + } ++ s = *j.template get_ptr(); ++} ++ ++template < ++ typename BasicJsonType, typename CompatibleStringType, ++ enable_if_t < ++ is_compatible_string_type::value and ++ not std::is_same::value and ++ std::is_constructible < ++ BasicJsonType, typename CompatibleStringType::value_type >::value, ++ int > = 0 > ++void from_json(const BasicJsonType& j, CompatibleStringType& s) ++{ ++ if (JSON_UNLIKELY(not j.is_string())) ++ { ++ JSON_THROW(type_error::create(302, "type must be string, but is " + std::string(j.type_name()))); ++ } ++ + s = *j.template get_ptr(); + } +