Fix ambiguous static_cast (#5221)

* 🚷 fix ambiguous static_cast

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

*  add regression test

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🚷 fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

* 🎓 fix warning

Signed-off-by: Niels Lohmann <mail@nlohmann.me>

---------

Signed-off-by: Niels Lohmann <mail@nlohmann.me>
This commit is contained in:
Niels Lohmann
2026-07-02 17:13:04 +02:00
committed by GitHub
parent 8d7e0046f4
commit 31dd15b258
4 changed files with 20 additions and 6 deletions
+10
View File
@@ -66,7 +66,17 @@ using ordered_json = nlohmann::ordered_json;
#endif
#endif
/////////////////////////////////////////////////////////////////////
// for #4825 - explicitly instantiating basic_json must compile; this
// forces instantiation of binary_writer::write_bjdata_ndarray, whose
// static_cast<string_t> was ambiguous under explicit instantiation on
// C++17. Merely compiling this translation unit is the regression test.
/////////////////////////////////////////////////////////////////////
template class nlohmann::basic_json<>;
/////////////////////////////////////////////////////////////////////
// for #4440
/////////////////////////////////////////////////////////////////////
#if JSON_HAS_RANGES == 1
#include <ranges>
#endif