#3669·json

未完整类型(boost::optional)的无效使用/编译错误

作者: a-w50创建于 2022年8月4日更新于 2026年9月27日
标签kind: bugsolution: proposed fix

在文件中包含来自 <source>:3: 的内容: /opt/compiler-explorer/libs/nlohmann_json/v3.6.0/single_include/nlohmann/json.hpp: 在替换 'template<class Expected, template<class ...> class Op, class ... Args> using is_detected_exact = std::is_same<Expected, typename nlohmann::detail::detector<nlohmann::detail::nonesuch, void, Op, Args ...>::type> [with Expected = void; Op = nlohmann::detail::to_json_function; Args = {nlohmann::adl_serializer<Dummy, void>, nlohmann::basic_json<std::map, std::vector, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, bool, long int, long unsigned int, double, std::allocator, nlohmann::adl_serializer>&, Dummy}]': /opt/compiler-explorer/libs/nlohmann_json/v3.6.0/single_include/nlohmann/json.hpp:986:13: 要求 'constexpr const bool nlohmann::detail::has_to_json<nlohmann::basic_json<>, Dummy, void>::value' /opt/compiler-explorer/libs/nlohmann_json/v3.6.0/single_include/nlohmann/json.hpp:1204:53: 要求 'constexpr const bool nlohmann::detail::is_compatible_type_impl<nlohmann::basic_json<>, Dummy, void>::value' /opt/compiler-explorer/libs/nlohmann_json/v3.6.0/single_include/nlohmann/json.hpp:14016:55: 由 'template<class CompatibleType, class U, typename std::enable_if<((! nlohmann::detail::is_basic_json<T>::value) && nlohmann::detail::is_compatible_type<nlohmann::basic_json<>, U>::value), int>::type <anonymous> > nlohmann::basic_json<>::basic_json(CompatibleType&&) [with CompatibleType = Dummy; U = Dummy; typename std::enable_if<((! nlohmann::detail::is_basic_json<T>::value) && nlohmann::detail::is_compatible_type<nlohmann::basic_json<>, U>::value), int>::type <anonymous> = <missing>]' 所做的替换所需 /opt/compiler-explorer/libs/boost_1_79_0/boost/type_traits/is_constructible.hpp:37:65: 由 'template<class T, class Arg, class> static boost::type_traits::yes_type