diff --git a/appveyor.yml b/appveyor.yml index 0dfc34e9..0a92a6c9 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -3,6 +3,21 @@ version: '{build}' environment: matrix: - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + configuration: Debug + platform: x86 + CXX_FLAGS: "" + LINKER_FLAGS: "" + GENERATOR: Visual Studio 14 2015 + + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + configuration: Debug + platform: x86 + CXX_FLAGS: "" + LINKER_FLAGS: "" + GENERATOR: Visual Studio 15 2017 + + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + configuration: Debug COMPILER: mingw platform: x86 CXX_FLAGS: "" @@ -10,36 +25,58 @@ environment: GENERATOR: Ninja - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + configuration: Release + COMPILER: mingw + platform: x86 + CXX_FLAGS: "" + LINKER_FLAGS: "" + GENERATOR: Ninja + + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + configuration: Release platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" GENERATOR: Visual Studio 14 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + configuration: Release + platform: x86 + name: with_win_header + CXX_FLAGS: "" + LINKER_FLAGS: "" + GENERATOR: Visual Studio 14 2015 + - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + configuration: Release platform: x86 CXX_FLAGS: "" LINKER_FLAGS: "" GENERATOR: Visual Studio 15 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + configuration: Release platform: x86 CXX_FLAGS: "/permissive- /std:c++latest /utf-8" LINKER_FLAGS: "" GENERATOR: Visual Studio 15 2017 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2015 + configuration: Release platform: x64 CXX_FLAGS: "" LINKER_FLAGS: "" GENERATOR: Visual Studio 14 2015 Win64 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + configuration: Release platform: x64 CXX_FLAGS: "" LINKER_FLAGS: "" GENERATOR: Visual Studio 15 2017 Win64 - APPVEYOR_BUILD_WORKER_IMAGE: Visual Studio 2017 + configuration: Release platform: x64 CXX_FLAGS: "/permissive- /std:c++latest /utf-8 /F4000000" LINKER_FLAGS: "/STACK:4000000" @@ -57,10 +94,18 @@ install: - if "%COMPILER%"=="mingw" g++ --version before_build: - - cmake . -G "%GENERATOR%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" + # for with_win_header build, inject the inclusion of Windows.h to the single-header library + - ps: if ($env:name -Eq "with_win_header") { $header_path = "single_include\nlohmann\json.hpp" } + - ps: if ($env:name -Eq "with_win_header") { "#include `n" + (Get-Content $header_path | Out-String) | Set-Content $header_path } + - cmake . -G "%GENERATOR%" -DCMAKE_BUILD_TYPE="%configuration%" -DCMAKE_CXX_FLAGS="%CXX_FLAGS%" -DCMAKE_EXE_LINKER_FLAGS="%LINKER_FLAGS%" -DCMAKE_IGNORE_PATH="C:/Program Files/Git/usr/bin" build_script: - - cmake --build . --config Release + - cmake --build . --config "%configuration%" test_script: - - ctest -C Release -V -j + - if "%configuration%"=="Release" ctest -C "%configuration%" -V -j + # On Debug builds, skip test-unicode_all + # as it is extremely slow to run and cause + # occasional timeouts on AppVeyor. + # More info: https://github.com/nlohmann/json/pull/1570 + - if "%configuration%"=="Debug" ctest --exclude-regex "test-unicode_all" -C "%configuration%" -V -j diff --git a/include/nlohmann/detail/iterators/iter_impl.hpp b/include/nlohmann/detail/iterators/iter_impl.hpp index 0b0282c2..bc87de29 100644 --- a/include/nlohmann/detail/iterators/iter_impl.hpp +++ b/include/nlohmann/detail/iterators/iter_impl.hpp @@ -118,6 +118,16 @@ class iter_impl to iterator is not defined. */ + /*! + @brief const copy constructor + @param[in] other const iterator to copy from + @note This copy constuctor had to be defined explicitely to circumvent a bug + occuring on msvc v19.0 compiler (VS 2015) debug build. For more + information refer to: https://github.com/nlohmann/json/issues/1608 + */ + iter_impl(const iter_impl& other) noexcept + : m_object(other.m_object), m_it(other.m_it) {} + /*! @brief converting constructor @param[in] other non-const iterator to copy from diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index bb2dacbc..08c4fc64 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -7821,6 +7821,16 @@ class iter_impl to iterator is not defined. */ + /*! + @brief const copy constructor + @param[in] other const iterator to copy from + @note This copy constuctor had to be defined explicitely to circumvent a bug + occuring on msvc v19.0 compiler (VS 2015) debug build. For more + information refer to: https://github.com/nlohmann/json/issues/1608 + */ + iter_impl(const iter_impl& other) noexcept + : m_object(other.m_object), m_it(other.m_it) {} + /*! @brief converting constructor @param[in] other non-const iterator to copy from diff --git a/test/src/unit-concepts.cpp b/test/src/unit-concepts.cpp index 9649af40..f28f0432 100644 --- a/test/src/unit-concepts.cpp +++ b/test/src/unit-concepts.cpp @@ -73,8 +73,8 @@ TEST_CASE("concepts") // X::size_type must return an unsigned integer CHECK((std::is_unsigned::value)); // X::size_type can represent any non-negative value of X::difference_type - CHECK(static_cast(std::numeric_limits::max()) <= - std::numeric_limits::max()); + CHECK(static_cast((std::numeric_limits::max)()) <= + (std::numeric_limits::max)()); // the expression "X u" has the post-condition "u.empty()" { diff --git a/test/src/unit-regression.cpp b/test/src/unit-regression.cpp index 6b7d90aa..88b12114 100644 --- a/test/src/unit-regression.cpp +++ b/test/src/unit-regression.cpp @@ -719,7 +719,7 @@ TEST_CASE("regression tests") }; check_roundtrip(100000000000.1236); - check_roundtrip(std::numeric_limits::max()); + check_roundtrip((std::numeric_limits::max)()); // Some more numbers which fail to roundtrip when serialized with digits10 significand digits (instead of max_digits10) check_roundtrip(1.541888611948064e-17);