diff --git a/tests/src/unit-json_view.cpp b/tests/src/unit-json_view.cpp index 6e91200b4..ea3be303a 100644 --- a/tests/src/unit-json_view.cpp +++ b/tests/src/unit-json_view.cpp @@ -511,27 +511,31 @@ TEST_CASE("json_view") { using nlohmann::detail::is_detected; - // a length is not a flag: parse(ptr, len) would convert len to - // allow_exceptions and read ptr as a C string, which need not end static_assert(is_detected::value, "parse(ptr, bool) is valid"); static_assert(is_detected::value, "parse(ptr, bool, bool, bool) is valid"); static_assert(is_detected::value, "parse(first, last) is valid"); static_assert(is_detected::value, "parse(first, last, bool) is valid"); + static_assert(is_detected::value, "parse_copy(ptr, bool) is valid"); + static_assert(is_detected::value, "accept(ptr, bool) is valid"); + static_assert(is_detected::value, "read(ptr, bool) is valid"); + + // a length is not a flag: parse(ptr, len) would convert len to + // allow_exceptions and read ptr as a C string, which need not end + // + // MSVC 2015 does not treat selecting a deleted function in decltype as + // a substitution failure, so it detects the deleted overloads as + // callable; calling them still fails to compile +#if !(defined(_MSC_VER) && _MSC_VER < 1910) static_assert(!is_detected::value, "parse(ptr, len) must not compile"); static_assert(!is_detected::value, "parse(ptr, int) must not compile"); static_assert(!is_detected::value, "parse(ptr, char) must not compile"); static_assert(!is_detected::value, "parse(ptr, len, bool) must not compile"); static_assert(!is_detected::value, "parse(string, len) must not compile"); static_assert(!is_detected&, std::size_t>::value, "parse(vector, len) must not compile"); - - static_assert(is_detected::value, "parse_copy(ptr, bool) is valid"); static_assert(!is_detected::value, "parse_copy(ptr, len) must not compile"); - - static_assert(is_detected::value, "accept(ptr, bool) is valid"); static_assert(!is_detected::value, "accept(ptr, len) must not compile"); - - static_assert(is_detected::value, "read(ptr, bool) is valid"); static_assert(!is_detected::value, "read(ptr, len) must not compile"); +#endif // json_view has no conversion to bool: unlike basic_json's, it would // mean "exists", not "is not null"; use is_discarded()