From 9d9c5216d766f1b4d2e3ac4031064e27951ddcdb Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 10:59:45 +0200 Subject: [PATCH 1/7] :construction_worker: additional flags for MSVC #464 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit To test a fix for issue #464 (not yet implemented), we first need to have an MSVC build with “/permissive- /std:c++latest /utf-8”. --- appveyor.yml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/appveyor.yml b/appveyor.yml index 0d85453e..cabfd143 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -8,13 +8,17 @@ os: - Visual Studio 2015 - Visual Studio 2017 +environment: + - additional_flags: "${CMAKE_CXXFLAGS}" + - additional_flags: "${CMAKE_CXXFLAGS} /permissive- /std:c++latest /utf-8" + init: [] install: [] build_script: - IF "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" ( SET GEN="Visual Studio 14 2015") ELSE (SET GEN="Visual Studio 15 2017") - - cmake . -G%GEN% + - cmake . -G%GEN% -DCMAKE_CXX_FLAGS=%additional_flags% - cmake --build . --config Release test_script: From d3d87674c8fad6af27d018b74c547d3a37249195 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 11:00:39 +0200 Subject: [PATCH 2/7] :construction_worker: fixed AppVeyor syntax --- appveyor.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/appveyor.yml b/appveyor.yml index cabfd143..409f5230 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,7 @@ os: - Visual Studio 2017 environment: + matrix: - additional_flags: "${CMAKE_CXXFLAGS}" - additional_flags: "${CMAKE_CXXFLAGS} /permissive- /std:c++latest /utf-8" From 180d249f6c78e7699798ef2a818bedd4f2dd11be Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 11:38:42 +0200 Subject: [PATCH 3/7] :construction_worker: another try --- appveyor.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 409f5230..f1122d59 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -10,8 +10,8 @@ os: environment: matrix: - - additional_flags: "${CMAKE_CXXFLAGS}" - - additional_flags: "${CMAKE_CXXFLAGS} /permissive- /std:c++latest /utf-8" + - additional_flags: "" + - additional_flags: "/permissive- /std:c++latest /utf-8" init: [] @@ -19,7 +19,7 @@ install: [] build_script: - IF "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" ( SET GEN="Visual Studio 14 2015") ELSE (SET GEN="Visual Studio 15 2017") - - cmake . -G%GEN% -DCMAKE_CXX_FLAGS=%additional_flags% + - cmake . -G%GEN% -DCMAKE_CXX_FLAGS="${CMAKE_CXXFLAGS} %additional_flags%" - cmake --build . --config Release test_script: From a9f409458099a2bcb72f9d2d476b37e26483f25a Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 11:47:31 +0200 Subject: [PATCH 4/7] :construction_worker: another try --- appveyor.yml | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index f1122d59..1832f28c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -1,9 +1,5 @@ version: '{build}' -configuration: - - Debug - - Release - os: - Visual Studio 2015 - Visual Studio 2017 @@ -19,7 +15,7 @@ install: [] build_script: - IF "%APPVEYOR_BUILD_WORKER_IMAGE%" == "Visual Studio 2015" ( SET GEN="Visual Studio 14 2015") ELSE (SET GEN="Visual Studio 15 2017") - - cmake . -G%GEN% -DCMAKE_CXX_FLAGS="${CMAKE_CXXFLAGS} %additional_flags%" + - cmake . -G%GEN% -DCMAKE_CXX_FLAGS="%additional_flags%" - cmake --build . --config Release test_script: From c40c8ac92e9a34ddb417478ac7c52c5716aa401b Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 12:00:30 +0200 Subject: [PATCH 5/7] :construction_worker: excluding MSVC 2015 with "/permissive- /std:c++latest /utf-8" --- appveyor.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/appveyor.yml b/appveyor.yml index 1832f28c..4f423e2f 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -9,6 +9,11 @@ environment: - additional_flags: "" - additional_flags: "/permissive- /std:c++latest /utf-8" +matrix: + exclude: + - additional_flags: "/permissive- /std:c++latest /utf-8" + os: Visual Studio 2015 + init: [] install: [] From 628be157a27f71b4f045fc687d723f9e1bbdfc51 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 13:52:04 +0200 Subject: [PATCH 6/7] :bug: added fix for #464 --- src/json.hpp | 3 +++ src/json.hpp.re2c | 3 +++ 2 files changed, 6 insertions(+) diff --git a/src/json.hpp b/src/json.hpp index 98659054..bdbd351b 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -3729,6 +3729,9 @@ class basic_json not std::is_same::value #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value +#endif +#if defined(_MSC_VER) && defined(_HAS_CXX17) // fix for issue #464 + and not std::is_same::value #endif , int >::type = 0 > operator ValueType() const diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 5e90f611..6710233c 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -3729,6 +3729,9 @@ class basic_json not std::is_same::value #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value +#endif +#if defined(_MSC_VER) && defined(_HAS_CXX17) // fix for issue #464 + and not std::is_same::value #endif , int >::type = 0 > operator ValueType() const From e48114bbd6625e6199baa10cbfe783bb95c32604 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Sun, 9 Apr 2017 14:02:04 +0200 Subject: [PATCH 7/7] :hammer: check for value of _HAS_CXX17 --- src/json.hpp | 2 +- src/json.hpp.re2c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/json.hpp b/src/json.hpp index bdbd351b..3b8925a3 100644 --- a/src/json.hpp +++ b/src/json.hpp @@ -3730,7 +3730,7 @@ class basic_json #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value #endif -#if defined(_MSC_VER) && defined(_HAS_CXX17) // fix for issue #464 +#if defined(_MSC_VER) && defined(_HAS_CXX17) && _HAS_CXX17 == 1 // fix for issue #464 and not std::is_same::value #endif , int >::type = 0 > diff --git a/src/json.hpp.re2c b/src/json.hpp.re2c index 6710233c..eca19ccf 100644 --- a/src/json.hpp.re2c +++ b/src/json.hpp.re2c @@ -3730,7 +3730,7 @@ class basic_json #ifndef _MSC_VER // fix for issue #167 operator<< ambiguity under VS2015 and not std::is_same>::value #endif -#if defined(_MSC_VER) && defined(_HAS_CXX17) // fix for issue #464 +#if defined(_MSC_VER) && defined(_HAS_CXX17) && _HAS_CXX17 == 1 // fix for issue #464 and not std::is_same::value #endif , int >::type = 0 >