Skip to content
This repository has been archived by the owner on Nov 13, 2023. It is now read-only.

Commit

Permalink
Remove invalid nondependent static assert (microsoft#1186)
Browse files Browse the repository at this point in the history
* Remove invalid static_assert(false).

* Turn on permissive-.

* clang-format
  • Loading branch information
BillyONeal authored Jul 12, 2019
1 parent 643dc60 commit a718c5b
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 4 additions & 0 deletions Release/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,6 +188,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}")
Expand Down
18 changes: 6 additions & 12 deletions Release/include/cpprest/streams.h
Original file line number Diff line number Diff line change
Expand Up @@ -528,9 +528,12 @@ class type_parser
public:
static pplx::task<T> parse(streams::streambuf<CharType> buffer)
{
typename _type_parser_integral_traits<T>::_is_integral ii;
typename _type_parser_integral_traits<T>::_is_unsigned ui;
return _parse(buffer, ii, ui);
typedef typename _type_parser_integral_traits<T>::_is_integral ii;
typedef typename _type_parser_integral_traits<T>::_is_unsigned ui;

static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream");

return _parse(buffer, ii {}, ui {});
}

private:
Expand All @@ -539,15 +542,6 @@ class type_parser
_parse_floating_point(buffer);
}

static pplx::task<T> _parse(streams::streambuf<CharType>, 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<T> _parse(streams::streambuf<CharType> buffer, std::true_type, std::false_type)
{
return type_parser<CharType, int64_t>::parse(buffer).then([](pplx::task<int64_t> op) -> T {
Expand Down

0 comments on commit a718c5b

Please sign in to comment.