Unverified Commit f907f950 authored by Niels Lohmann's avatar Niels Lohmann Committed by GitHub

Merge pull request #2875 from nlohmann/issue2592

Suppress C4127 warning in unit-json_pointer.cpp
parents c89e23c6 92ec3573
...@@ -358,6 +358,10 @@ TEST_CASE("JSON pointers") ...@@ -358,6 +358,10 @@ TEST_CASE("JSON pointers")
CHECK_THROWS_WITH(j_const[jp] == 1, throw_msg.c_str()); CHECK_THROWS_WITH(j_const[jp] == 1, throw_msg.c_str());
} }
#if defined(_MSC_VER)
#pragma warning (push)
#pragma warning (disable : 4127) // on some machines, the check below is not constant
#endif
if (sizeof(typename json::size_type) < sizeof(unsigned long long)) if (sizeof(typename json::size_type) < sizeof(unsigned long long))
{ {
auto size_type_max_uul = static_cast<unsigned long long>((std::numeric_limits<json::size_type>::max)()); auto size_type_max_uul = static_cast<unsigned long long>((std::numeric_limits<json::size_type>::max)());
...@@ -371,6 +375,10 @@ TEST_CASE("JSON pointers") ...@@ -371,6 +375,10 @@ TEST_CASE("JSON pointers")
CHECK_THROWS_WITH(j_const[jp] == 1, throw_msg.c_str()); CHECK_THROWS_WITH(j_const[jp] == 1, throw_msg.c_str());
} }
#if defined(_MSC_VER)
#pragma warning (pop)
#endif
CHECK_THROWS_AS(j.at("/one"_json_pointer) = 1, json::parse_error&); CHECK_THROWS_AS(j.at("/one"_json_pointer) = 1, json::parse_error&);
CHECK_THROWS_WITH(j.at("/one"_json_pointer) = 1, CHECK_THROWS_WITH(j.at("/one"_json_pointer) = 1,
"[json.exception.parse_error.109] parse error: array index 'one' is not a number"); "[json.exception.parse_error.109] parse error: array index 'one' is not a number");
......
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