From 17f5b3f4c2619b3443c01492ea9109e8b1c442a3 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 11 Jul 2022 17:02:00 +0100 Subject: [PATCH 1/2] decltype not typeof It's been too long since I wrote C++... --- include/nlohmann/detail/input/lexer.hpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/input/lexer.hpp b/include/nlohmann/detail/input/lexer.hpp index 9809b4e89..f516dd7a2 100644 --- a/include/nlohmann/detail/input/lexer.hpp +++ b/include/nlohmann/detail/input/lexer.hpp @@ -1250,7 +1250,7 @@ scan_number_done: if (errno == 0) { value_unsigned = static_cast(x); - if (static_cast(value_unsigned) == x) + if (static_cast(value_unsigned) == x) { return token_type::value_unsigned; } @@ -1266,7 +1266,7 @@ scan_number_done: if (errno == 0) { value_integer = static_cast(x); - if (static_cast(value_integer) == x) + if (static_cast(value_integer) == x) { return token_type::value_integer; } From 3d0c1ba3ee3dd780641f96ba9a4ee9f09cbb3896 Mon Sep 17 00:00:00 2001 From: Eric Wieser Date: Mon, 11 Jul 2022 19:36:37 +0100 Subject: [PATCH 2/2] Update unit-custom-integer.cpp --- tests/src/unit-custom-integer.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/src/unit-custom-integer.cpp b/tests/src/unit-custom-integer.cpp index 0e3baf440..101f76cca 100644 --- a/tests/src/unit-custom-integer.cpp +++ b/tests/src/unit-custom-integer.cpp @@ -94,11 +94,11 @@ template class std::numeric_limits> TEST_CASE("custom integer types") { - using json = nlohmann::basic_json < - std::map, std::vector, std::string, bool, - wrapped_int, wrapped_int, double, std::allocator >; + using my_json = nlohmann::basic_json < + std::map, std::vector, std::string, bool, + wrapped_int, wrapped_int, double, std::allocator >; std::string data = "[1,2,-3,-4]"; - json as_json = json::parse(data.begin(), data.end()); + my_json as_json = my_json::parse(data.begin(), data.end()); wrapped_int i1 = as_json[1]; wrapped_int i2 = as_json[2]; CHECK(i1 == wrapped_int(2));