diff --git a/Makefile b/Makefile index 1deb8da5..bfb62349 100644 --- a/Makefile +++ b/Makefile @@ -191,7 +191,10 @@ pedantic_gcc: -Wunused-macros \ -Wunused-parameter \ -Wuseless-cast \ - -Wvariadic-macros" + -Wvariadic-macros \ + -Wctor-dtor-privacy \ + -Winit-self \ + -Wstrict-null-sentinel" ########################################################################## # benchmarks diff --git a/include/nlohmann/detail/macro_scope.hpp b/include/nlohmann/detail/macro_scope.hpp index 5f0824fe..834ac241 100644 --- a/include/nlohmann/detail/macro_scope.hpp +++ b/include/nlohmann/detail/macro_scope.hpp @@ -115,11 +115,9 @@ contains a `mapped_type`, whereas `std::vector` fails the test. */ #define NLOHMANN_JSON_HAS_HELPER(type) \ template<typename T> struct has_##type { \ - private: \ template<typename U, typename = typename U::type> \ static int detect(U &&); \ static void detect(...); \ - public: \ static constexpr bool value = \ std::is_integral<decltype(detect(std::declval<T>()))>::value; \ } diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index caf81222..d3a6584d 100644 --- a/include/nlohmann/detail/meta/type_traits.hpp +++ b/include/nlohmann/detail/meta/type_traits.hpp @@ -141,14 +141,12 @@ struct is_compatible_integer_type template<typename BasicJsonType, typename T> struct has_from_json { - private: // also check the return type of from_json template<typename U, typename = enable_if_t<std::is_same<void, decltype(uncvref_t<U>::from_json( std::declval<BasicJsonType>(), std::declval<T&>()))>::value>> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral<decltype( detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value; }; @@ -158,7 +156,6 @@ struct has_from_json template<typename BasicJsonType, typename T> struct has_non_default_from_json { - private: template < typename U, typename = enable_if_t<std::is_same< @@ -166,7 +163,6 @@ struct has_non_default_from_json static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral<decltype(detect( std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value; }; @@ -175,13 +171,11 @@ struct has_non_default_from_json template<typename BasicJsonType, typename T> struct has_to_json { - private: template<typename U, typename = decltype(uncvref_t<U>::to_json( std::declval<BasicJsonType&>(), std::declval<T>()))> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral<decltype(detect( std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value; }; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ac27d3d4..9984f14e 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -230,11 +230,9 @@ contains a `mapped_type`, whereas `std::vector` fails the test. */ #define NLOHMANN_JSON_HAS_HELPER(type) \ template<typename T> struct has_##type { \ - private: \ template<typename U, typename = typename U::type> \ static int detect(U &&); \ static void detect(...); \ - public: \ static constexpr bool value = \ std::is_integral<decltype(detect(std::declval<T>()))>::value; \ } @@ -471,14 +469,12 @@ struct is_compatible_integer_type template<typename BasicJsonType, typename T> struct has_from_json { - private: // also check the return type of from_json template<typename U, typename = enable_if_t<std::is_same<void, decltype(uncvref_t<U>::from_json( std::declval<BasicJsonType>(), std::declval<T&>()))>::value>> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral<decltype( detect(std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value; }; @@ -488,7 +484,6 @@ struct has_from_json template<typename BasicJsonType, typename T> struct has_non_default_from_json { - private: template < typename U, typename = enable_if_t<std::is_same< @@ -496,7 +491,6 @@ struct has_non_default_from_json static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral<decltype(detect( std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value; }; @@ -505,13 +499,11 @@ struct has_non_default_from_json template<typename BasicJsonType, typename T> struct has_to_json { - private: template<typename U, typename = decltype(uncvref_t<U>::to_json( std::declval<BasicJsonType&>(), std::declval<T>()))> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral<decltype(detect( std::declval<typename BasicJsonType::template json_serializer<T, void>>()))>::value; };