From eb30ff0615f626f7c8b98c8d46bdfac8af758949 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 6 Sep 2018 07:25:19 +0200 Subject: [PATCH] :rotating_light: fixed a compiler warning #1224 --- Makefile | 5 ++++- include/nlohmann/detail/macro_scope.hpp | 2 -- include/nlohmann/detail/meta/type_traits.hpp | 6 ------ single_include/nlohmann/json.hpp | 8 -------- 4 files changed, 4 insertions(+), 17 deletions(-) diff --git a/Makefile b/Makefile index 1deb8da511..bfb623496a 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 5f0824fead..834ac2416f 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 struct has_##type { \ - private: \ template \ static int detect(U &&); \ static void detect(...); \ - public: \ static constexpr bool value = \ std::is_integral()))>::value; \ } diff --git a/include/nlohmann/detail/meta/type_traits.hpp b/include/nlohmann/detail/meta/type_traits.hpp index caf8122261..d3a6584d4b 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 struct has_from_json { - private: // also check the return type of from_json template::from_json( std::declval(), std::declval()))>::value>> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral>()))>::value; }; @@ -158,7 +156,6 @@ struct has_from_json template struct has_non_default_from_json { - private: template < typename U, typename = enable_if_t>()))>::value; }; @@ -175,13 +171,11 @@ struct has_non_default_from_json template struct has_to_json { - private: template::to_json( std::declval(), std::declval()))> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral>()))>::value; }; diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index ac27d3d4cc..9984f14eb5 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 struct has_##type { \ - private: \ template \ static int detect(U &&); \ static void detect(...); \ - public: \ static constexpr bool value = \ std::is_integral()))>::value; \ } @@ -471,14 +469,12 @@ struct is_compatible_integer_type template struct has_from_json { - private: // also check the return type of from_json template::from_json( std::declval(), std::declval()))>::value>> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral>()))>::value; }; @@ -488,7 +484,6 @@ struct has_from_json template struct has_non_default_from_json { - private: template < typename U, typename = enable_if_t>()))>::value; }; @@ -505,13 +499,11 @@ struct has_non_default_from_json template struct has_to_json { - private: template::to_json( std::declval(), std::declval()))> static int detect(U&&); static void detect(...); - public: static constexpr bool value = std::is_integral>()))>::value; };