diff --git a/include/nlohmann/json.hpp b/include/nlohmann/json.hpp index f915cbc0f..765b5dba5 100644 --- a/include/nlohmann/json.hpp +++ b/include/nlohmann/json.hpp @@ -5397,7 +5397,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec R apply_r(Fn&& f, Args&& ... args) { R out; - apply_cb([&out](R && r) noexcept(noexcept(out = std::forward(r))) + // dynamic noexcept specifier fails to compile on Clang <3.6 + apply_cb([&out](R && r) +#if !defined(__clang__) || (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ > 5) + noexcept(noexcept(out = std::forward(r))) +#endif { out = std::forward(r); }, std::forward(f), std::forward(args)...); @@ -5408,7 +5412,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec R apply_r(Fn&& f, Args&& ... args) const { R out; - apply_cb([&out](R && r) noexcept(noexcept(out = std::forward(r))) + // dynamic noexcept specifier fails to compile on Clang <3.6 + apply_cb([&out](R && r) +#if !defined(__clang__) || (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ > 5) + noexcept(noexcept(out = std::forward(r))) +#endif { out = std::forward(r); }, std::forward(f), std::forward(args)...); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index d8149a368..a9ff34111 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -23777,7 +23777,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec R apply_r(Fn&& f, Args&& ... args) { R out; - apply_cb([&out](R && r) noexcept(noexcept(out = std::forward(r))) + // dynamic noexcept specifier fails to compile on Clang <3.6 + apply_cb([&out](R && r) +#if !defined(__clang__) || (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ > 5) + noexcept(noexcept(out = std::forward(r))) +#endif { out = std::forward(r); }, std::forward(f), std::forward(args)...); @@ -23788,7 +23792,11 @@ class basic_json // NOLINT(cppcoreguidelines-special-member-functions,hicpp-spec R apply_r(Fn&& f, Args&& ... args) const { R out; - apply_cb([&out](R && r) noexcept(noexcept(out = std::forward(r))) + // dynamic noexcept specifier fails to compile on Clang <3.6 + apply_cb([&out](R && r) +#if !defined(__clang__) || (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ > 5) + noexcept(noexcept(out = std::forward(r))) +#endif { out = std::forward(r); }, std::forward(f), std::forward(args)...); diff --git a/tests/src/unit-apply.cpp b/tests/src/unit-apply.cpp index d01ee1dc2..9486eae72 100644 --- a/tests/src/unit-apply.cpp +++ b/tests/src/unit-apply.cpp @@ -336,10 +336,6 @@ TEST_CASE("apply*() functions") } } - // apply_cb() (which apply_r() is based on) fails on Clang - // due to is_invocable not yielding true as expected - // while testing the invocable implementation Clang 3.5 crashed -#if !defined(__clang__) || (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ < 6) SECTION("apply_r()") { SECTION("value types") @@ -653,6 +649,8 @@ TEST_CASE("apply*() functions") CHECK(f.bar == 42); } } + + // add functor } }