File tree Expand file tree Collapse file tree 1 file changed +4
-3
lines changed
Expand file tree Collapse file tree 1 file changed +4
-3
lines changed Original file line number Diff line number Diff line change @@ -538,14 +538,15 @@ struct CustomUintFormatter
538538
539539 template <typename Stream, typename I> void Unser (Stream& s, I& v)
540540 {
541- static_assert (std::numeric_limits<I>::max () >= MAX && std::numeric_limits<I>::min () <= 0 , " CustomUintFormatter type too small" );
541+ using U = typename std::conditional<std::is_enum<I>::value, std::underlying_type<I>, std::common_type<I>>::type::type;
542+ static_assert (std::numeric_limits<U>::max () >= MAX && std::numeric_limits<U>::min () <= 0 , " Assigned type too small" );
542543 uint64_t raw = 0 ;
543544 if (BigEndian) {
544545 s.read (((char *)&raw) + 8 - Bytes, Bytes);
545- v = be64toh (raw);
546+ v = static_cast <I>( be64toh (raw) );
546547 } else {
547548 s.read ((char *)&raw, Bytes);
548- v = le64toh (raw);
549+ v = static_cast <I>( le64toh (raw) );
549550 }
550551 }
551552};
You can’t perform that action at this time.
0 commit comments