Skip to content

Commit a718c5b

Browse files
authored
Remove invalid nondependent static assert (microsoft#1186)
* Remove invalid static_assert(false). * Turn on permissive-. * clang-format
1 parent 643dc60 commit a718c5b

File tree

2 files changed

+10
-12
lines changed

2 files changed

+10
-12
lines changed

Release/CMakeLists.txt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,6 +188,10 @@ elseif(CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
188188
if (WINDOWS_STORE OR WINDOWS_PHONE)
189189
add_compile_options(/ZW)
190190
endif()
191+
192+
if (NOT (MSVC_VERSION LESS 1920))
193+
add_compile_options(/permissive-)
194+
endif()
191195
else()
192196
message("-- Unknown compiler, success is doubtful.")
193197
message("CMAKE_CXX_COMPILER_ID=${CMAKE_CXX_COMPILER_ID}")

Release/include/cpprest/streams.h

Lines changed: 6 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -528,9 +528,12 @@ class type_parser
528528
public:
529529
static pplx::task<T> parse(streams::streambuf<CharType> buffer)
530530
{
531-
typename _type_parser_integral_traits<T>::_is_integral ii;
532-
typename _type_parser_integral_traits<T>::_is_unsigned ui;
533-
return _parse(buffer, ii, ui);
531+
typedef typename _type_parser_integral_traits<T>::_is_integral ii;
532+
typedef typename _type_parser_integral_traits<T>::_is_unsigned ui;
533+
534+
static_assert(ii::value || !ui::value, "type is not supported for extraction from a stream");
535+
536+
return _parse(buffer, ii {}, ui {});
534537
}
535538

536539
private:
@@ -539,15 +542,6 @@ class type_parser
539542
_parse_floating_point(buffer);
540543
}
541544

542-
static pplx::task<T> _parse(streams::streambuf<CharType>, std::false_type, std::true_type)
543-
{
544-
#ifdef _WIN32
545-
static_assert(false, "type is not supported for extraction from a stream");
546-
#else
547-
throw std::runtime_error("type is not supported for extraction from a stream");
548-
#endif
549-
}
550-
551545
static pplx::task<T> _parse(streams::streambuf<CharType> buffer, std::true_type, std::false_type)
552546
{
553547
return type_parser<CharType, int64_t>::parse(buffer).then([](pplx::task<int64_t> op) -> T {

0 commit comments

Comments
 (0)