diff --git a/include/nlohmann/detail/macro_scope.hpp b/include/nlohmann/detail/macro_scope.hpp index 25e6b76eb..172b8eb90 100644 --- a/include/nlohmann/detail/macro_scope.hpp +++ b/include/nlohmann/detail/macro_scope.hpp @@ -20,10 +20,15 @@ #endif // C++ language standard detection -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +// fix for issue #464 +#if (defined(__cplusplus) && __cplusplus >= 201703L) || \ + (defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \ + (defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0) #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) +#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \ + (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4) #define JSON_HAS_CPP_14 #endif diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 035107415..9b2093fff 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -2048,10 +2048,15 @@ JSON_HEDLEY_DIAGNOSTIC_POP #endif // C++ language standard detection -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +// fix for issue #464 +#if (defined(__cplusplus) && __cplusplus >= 201703L) || \ + (defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \ + (defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0) #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) +#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \ + (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4) #define JSON_HAS_CPP_14 #endif diff --git a/test/src/unit-conversions.cpp b/test/src/unit-conversions.cpp index d37e8e9b2..07ab90fe5 100644 --- a/test/src/unit-conversions.cpp +++ b/test/src/unit-conversions.cpp @@ -41,11 +41,15 @@ using nlohmann::json; #include #include #include - -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +// fix for issue #464 +#if (defined(__cplusplus) && __cplusplus >= 201703L) || \ + (defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \ + (defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0) #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) +#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \ + (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4) #define JSON_HAS_CPP_14 #endif diff --git a/test/src/unit-items.cpp b/test/src/unit-items.cpp index 00d6a0875..659926f16 100644 --- a/test/src/unit-items.cpp +++ b/test/src/unit-items.cpp @@ -31,11 +31,15 @@ SOFTWARE. #include using nlohmann::json; - -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +// fix for issue #464 +#if (defined(__cplusplus) && __cplusplus >= 201703L) || \ + (defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \ + (defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0) #define JSON_HAS_CPP_17 #define JSON_HAS_CPP_14 -#elif (defined(__cplusplus) && __cplusplus >= 201402L) || (defined(_HAS_CXX14) && _HAS_CXX14 == 1) +#elif (defined(__cplusplus) && __cplusplus >= 201402L) || \ + (defined(_HAS_CXX14) && _HAS_CXX14 == 1) || \ + (defined(__clang__) && __clang_major__ == 3 && __clang_minor__ >= 4) #define JSON_HAS_CPP_14 #endif diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 8803ac90b..3445c872d 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -43,8 +43,10 @@ using nlohmann::json; #include #include #include - -#if (defined(__cplusplus) && __cplusplus >= 201703L) || (defined(_HAS_CXX17) && _HAS_CXX17 == 1) // fix for issue #464 +// fix for issue #464 +#if (defined(__cplusplus) && __cplusplus >= 201703L) || \ + (defined(_HAS_CXX17) && _HAS_CXX17 == 1) || \ + (defined(__clang__) && __clang_major__ == 5 && __clang_minor__ >= 0) #define JSON_HAS_CPP_17 #endif