Commit 2e281ba6 by Niels Lohmann Committed by GitHub

Merge pull request #788 from jseward/develop

Fix Visual Studio 2017 warnings
parents 7c8f0a41 a99fcb4e
...@@ -5292,7 +5292,7 @@ class binary_reader ...@@ -5292,7 +5292,7 @@ class binary_reader
{ {
get(); get();
check_eof(); check_eof();
return current; return static_cast<char>(current);
}); });
return result; return result;
} }
......
...@@ -76,7 +76,10 @@ if(MSVC) ...@@ -76,7 +76,10 @@ if(MSVC)
endif() endif()
# Disable warning C4389: '==': signed/unsigned mismatch # Disable warning C4389: '==': signed/unsigned mismatch
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4389") # Disable warning C4309: 'static_cast': truncation of constant value
# Disable warning C4566: character represented by universal-character-name '\uFF01' cannot be represented in the current code page (1252)
# Disable warning C4996: 'nlohmann::basic_json<std::map,std::vector,std::string,bool,int64_t,uint64_t,double,std::allocator,nlohmann::adl_serializer>::operator <<': was declared deprecated
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4389 /wd4309 /wd4566 /wd4996")
endif() endif()
############################################################################# #############################################################################
......
...@@ -242,7 +242,7 @@ TEST_CASE("constructors") ...@@ -242,7 +242,7 @@ TEST_CASE("constructors")
SECTION("std::pair") SECTION("std::pair")
{ {
std::pair<float, std::string> p{1.0, "string"}; std::pair<float, std::string> p{1.0f, "string"};
json j(p); json j(p);
CHECK(j.type() == json::value_t::array); CHECK(j.type() == json::value_t::array);
......
...@@ -38,6 +38,11 @@ using nlohmann::json; ...@@ -38,6 +38,11 @@ using nlohmann::json;
#include <unordered_set> #include <unordered_set>
#include <iostream> #include <iostream>
#if defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4189) // local variable is initialized but not referenced
#endif
TEST_CASE("README", "[hide]") TEST_CASE("README", "[hide]")
{ {
{ {
...@@ -298,3 +303,7 @@ TEST_CASE("README", "[hide]") ...@@ -298,3 +303,7 @@ TEST_CASE("README", "[hide]")
std::cout.rdbuf(old_cout_buffer); std::cout.rdbuf(old_cout_buffer);
} }
} }
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment