cpp: fix overflow check for minimum number of signed integer type

This commit is contained in:
frsyuki 2009-08-19 15:10:10 +09:00
parent 92952f6566
commit b2381d0513

View File

@ -37,7 +37,7 @@ namespace detail {
{ throw type_error(); }
return o.via.u64;
} else if(o.type == type::NEGATIVE_INTEGER) {
if(o.via.i64 < (int64_t)-std::numeric_limits<T>::max())
if(o.via.i64 < (int64_t)std::numeric_limits<T>::min())
{ throw type_error(); }
return o.via.i64;
}