Add narrow_cast debug.

GitOrigin-RevId: e088bc1d01f880d1126000f3ecea0be70c2dbcb7
This commit is contained in:
levlam 2018-04-10 20:21:17 +03:00
parent cf015abf64
commit 4910a36a13

View File

@ -303,8 +303,9 @@ R narrow_cast(const A &a) {
static_assert(std::is_integral<AT>::value, "expected integral type to cast from");
auto r = R(a);
CHECK(A(r) == a);
CHECK((detail::is_same_signedness<RT, AT>::value) || ((static_cast<RT>(r) < RT{}) == (static_cast<AT>(a) < AT{})));
CHECK(A(r) == a) << static_cast<AT>(a) << " " << static_cast<RT>(r);
CHECK((detail::is_same_signedness<RT, AT>::value) || ((static_cast<RT>(r) < RT{}) == (static_cast<AT>(a) < AT{})))
<< static_cast<AT>(a) << " " << static_cast<RT>(r);
return r;
}