diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index d0c947bba..6c2ad70bc 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -1634,7 +1634,9 @@ class binary_writer }; string_t key = "_ArrayType_"; - auto it = bjdtype.find(static_cast(value.at(key))); + // use get() instead of static_cast to avoid an + // ambiguous conversion under explicit instantiation on C++17 (see #4825) + auto it = bjdtype.find(value.at(key).template get()); if (it == bjdtype.end()) { return true; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 36c1f1510..5c661684d 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -17820,7 +17820,9 @@ class binary_writer }; string_t key = "_ArrayType_"; - auto it = bjdtype.find(static_cast(value.at(key))); + // use get() instead of static_cast to avoid an + // ambiguous conversion under explicit instantiation on C++17 (see #4825) + auto it = bjdtype.find(value.at(key).template get()); if (it == bjdtype.end()) { return true;