Skip to content

Commit

Permalink
Merge pull request #2875 from nlohmann/issue2592
Browse files Browse the repository at this point in the history
Suppress C4127 warning in unit-json_pointer.cpp
  • Loading branch information
nlohmann authored Jul 16, 2021
2 parents c89e23c + 92ec357 commit f907f95
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions test/src/unit-json_pointer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -358,6 +358,10 @@ TEST_CASE("JSON pointers")
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))
{
auto size_type_max_uul = static_cast<unsigned long long>((std::numeric_limits<json::size_type>::max)());
Expand All @@ -371,6 +375,10 @@ TEST_CASE("JSON pointers")
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_WITH(j.at("/one"_json_pointer) = 1,
"[json.exception.parse_error.109] parse error: array index 'one' is not a number");
Expand Down

0 comments on commit f907f95

Please sign in to comment.