@@ -470,7 +470,7 @@ _UINT_TRAIT(unsigned long long, ULLONG_MIN, ULLONG_MAX)
470470 { \
471471 typedef std::true_type _is_integral; \
472472 typedef std::false_type _is_unsigned; \
473- static const int64_t _min = std::numeric_limits<_t>::min(); \
473+ static const int64_t _min = ( std::numeric_limits<_t>::min) (); \
474474 static const int64_t _max = (std::numeric_limits<_t>::max)(); \
475475 };
476476#define _UINT_TRAIT (_t ) \
@@ -528,9 +528,12 @@ class type_parser
528528public:
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
536539private:
@@ -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 {
@@ -1145,8 +1139,8 @@ pplx::task<ReturnType> _type_parser_base<CharType>::_parse_input(concurrency::st
11451139 auto update = [=](pplx::task<int_type> op) -> pplx::task<bool > {
11461140 int_type ch = op.get ();
11471141 if (ch == traits::eof ()) return pplx::task_from_result (false );
1148- bool accptd = accept_character (state, ch);
1149- if (!accptd ) return pplx::task_from_result (false );
1142+ bool accepted = accept_character (state, ch);
1143+ if (!accepted ) return pplx::task_from_result (false );
11501144 // We peeked earlier, so now we must advance the position.
11511145 concurrency::streams::streambuf<CharType> buf = buffer;
11521146 return buf.bumpc ().then ([](int_type) { return true ; });
@@ -1314,9 +1308,18 @@ struct _double_state
13141308template <typename FloatingPoint, typename int_type>
13151309static std::string create_exception_message (int_type ch, bool exponent)
13161310{
1317- std::ostringstream os;
1318- os << " Invalid character '" << char (ch) << " '" << (exponent ? " in exponent" : " " );
1319- return os.str ();
1311+ std::string result;
1312+ if (exponent)
1313+ {
1314+ result.assign (" Invalid character 'X' in exponent" );
1315+ }
1316+ else
1317+ {
1318+ result.assign (" Invalid character 'X'" );
1319+ }
1320+
1321+ result[19 ] = static_cast <char >(ch);
1322+ return result;
13201323}
13211324
13221325template <typename FloatingPoint, typename int_type>
0 commit comments