From d134832df8de0ce745ffd95ede5a228b82e79960 Mon Sep 17 00:00:00 2001 From: Billy O'Neal Date: Fri, 12 Jul 2019 16:27:44 -0700 Subject: [PATCH] Remove invalid nondependent static assert (#1186) * Remove invalid static_assert(false). * Turn on permissive-. * clang-format --- Release/CMakeLists.txt | 4 ++++ Release/include/cpprest/streams.h | 18 ++++++------------ 2 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Release/CMakeLists.txt b/Release/CMakeLists.txt index 994111f6d6..490427cfe7 100644 --- a/Release/CMakeLists.txt +++ b/Release/CMakeLists.txt @@ -185,6 +185,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC") if (WINDOWS_STORE OR WINDOWS_PHONE) add_compile_options(/ZW) endif() + + if (NOT (MSVC_VERSION LESS 1920)) + add_compile_options(/permissive-) + endif() else() message("-- Unknown compiler, success is doubtful.") message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}") diff --git a/Release/include/cpprest/streams.h b/Release/include/cpprest/streams.h index bfeeee5885..08713226b7 100644 --- a/Release/include/cpprest/streams.h +++ b/Release/include/cpprest/streams.h @@ -528,9 +528,12 @@ class type_parser public: static pplx::task parse(streams::streambuf buffer) { - typename _type_parser_integral_traits::_is_integral ii; - typename _type_parser_integral_traits::_is_unsigned ui; - return _parse(buffer, ii, ui); + typedef typename _type_parser_integral_traits::_is_integral ii; + typedef typename _type_parser_integral_traits::_is_unsigned ui; + + static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream"); + + return _parse(buffer, ii {}, ui {}); } private: @@ -539,15 +542,6 @@ class type_parser _parse_floating_point(buffer); } - static pplx::task _parse(streams::streambuf, std::false_type, std::true_type) - { -#ifdef _WIN32 - static_assert(false, "type is not supported for extraction from a stream"); -#else - throw std::runtime_error("type is not supported for extraction from a stream"); -#endif - } - static pplx::task _parse(streams::streambuf buffer, std::true_type, std::false_type) { return type_parser::parse(buffer).then([](pplx::task op) -> T {