From a598fe6931a5565bec2a53fcfa2988a811df3d9e Mon Sep 17 00:00:00 2001 From: "Ralf W. Grosse-Kunstleve" Date: Tue, 21 Jun 2022 10:37:53 -0700 Subject: [PATCH] Replace C++17 syntax. Compiles with Debian clang 13 C++11 mode, but fails to link. Trying GitHub Actions anyway to see if there are any platforms that support https://en.cppreference.com/w/cpp/language/tu_local before C++20. Note that Debian clang 13 C++17 works locally. --- include/pybind11/cast.h | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/include/pybind11/cast.h b/include/pybind11/cast.h index 9d7200e0b..aca09b0eb 100644 --- a/include/pybind11/cast.h +++ b/include/pybind11/cast.h @@ -67,7 +67,9 @@ bool odr_guard_impl(const std::type_index &it_ti, const char *tc_id) { && (tc_id_str[1] == '/' || tc_id_str[1] == '\\')) { tc_id_str = tc_id_str.substr(2); } - auto [reg_iter, added] = odr_guard_registry().insert({it_ti, tc_id_str}); + auto ins = odr_guard_registry().insert({it_ti, tc_id_str}); + auto reg_iter = ins.first; + auto added = ins.second; if (!added && reg_iter->second != tc_id_str) { std::system_error err(std::make_error_code(std::errc::state_not_recoverable), "ODR VIOLATION DETECTED: pybind11::detail::type_caster<"