Skip to content

COMP: Fix build of json(HelperFunction|Resource).cxx on AppleClang 11.0

David Thompson requested to merge dcthomp/smtk:fix-build-macos into master

This commit fixes the following error reported when building smtk using Apple clang version 11.0.3 (clang-1103.0.32.62) and nlohmann_json v3.8.0.

Error:

/Applications/Xcode_11.7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:3200:38: error: incomplete type 'pugi::xml_node' used in type trait expression : public integral_constant<bool, __is_constructible(_Tp, _Args...)> ^ /Applications/Xcode_11.7.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/type_traits:3446:14: note: in instantiation of template class 'std::__1::is_constructiblepugi::xml_node' requested here : public is_constructible<_Tp> ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:3069:10: note: in instantiation of template class 'std::__1::is_default_constructiblepugi::xml_node' requested here std::is_default_constructible::value and ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:3095:7: note: during template argument deduction for class template partial specialization 'is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType, enable_if_t<!std::is_same<ConstructibleArrayType, typename BasicJsonType::value_type>::value && std::is_default_constructible::value && (std::is_move_assignable::value || std::is_copy_assignable::value) && is_detected<value_type_t, ConstructibleArrayType>::value && is_detected<iterator_t, ConstructibleArrayType>::value && is_complete_type<detected_t<value_type_t, ConstructibleArrayType> >::value> >' [with BasicJsonType = nlohmann::basic_json<std::map, std::vector, std::__1::basic_string, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator > >, ConstructibleArrayType = pugi::xml_node] : is_constructible_array_type_impl<BasicJsonType, ConstructibleArrayType> {}; ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:3095:7: note: in instantiation of template class 'nlohmann::detail::is_constructible_array_type_impl<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator > >, pugi::xml_node, void>' requested here /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:3448:15: note: in instantiation of template class 'nlohmann::detail::is_constructible_array_type<nlohmann::basic_json<std::map, std::vector, std::__1::basic_string, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator > >, pugi::xml_node>' requested here is_constructible_array_type<BasicJsonType, ConstructibleArrayType>::value and ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:3454:6: note: (skipping 13 contexts in backtrace; use -ftemplate-backtrace-limit=0 to see all) auto from_json(const BasicJsonType& j, ConstructibleArrayType& arr) ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:2692:1: note: during template argument deduction for class template partial specialization 'detector<Default, void_t<Op<Args...> >, Op, Args...>' [with Default = nlohmann::detail::nonesuch, Op = get_template_function, Args = <const nlohmann::basic_json<std::map, std::vector, std::__1::basic_string, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator > > &, pugi::xml_node>] using is_detected = typename detector<nonesuch, void, Op, Args...>::value_t; ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:2692:1: note: in instantiation of template class 'nlohmann::detail::detector<nlohmann::detail::nonesuch, void, get_template_function, const nlohmann::basic_json<std::map, std::vector, std::__1::basic_string, bool, long long, unsigned long long, double, std::allocator, adl_serializer, std::__1::vector<unsigned char, std::__1::allocator > > &, pugi::xml_node>' requested here /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:18994:32: note: in instantiation of template type alias 'is_detected' requested here and detail::is_detected<detail::get_template_function, const basic_json_t&, ValueType>::value ^ /path/to/aevaSlicer-Release/nlohmann_json/single_include/nlohmann/json.hpp:18996:5: note: while substituting prior template arguments into non-type template parameter [with ValueType = pugi::xml_node] operator ValueType() const ^~~~~~~~~~~~~~~~~~~~~~~~~~ /path/to/aevaSlicer-Release/smtk/smtk/attribute/json/jsonResource.cxx:659:29: note: while substituting deduced template arguments into function template 'operator type-parameter-0-0' [with ValueType = pugi::xml_node, $1 = (no value)] (*associationRule) << associationRuleObj; ^ /path/to/aevaSlicer-Release/smtk/smtk/attribute/AssociationRule.h:26:7: note: forward declaration of 'pugi::xml_node' class xml_node; ^ 1 error generated.

Co-authored-by: Jean-Christophe Fillion-Robin jchris.fillionr@kitware.com

Merge request reports