我正在尝试为一些极端情况编写一个测试用例。对于 type 的输入int64_t
,以下行将无法编译:
int64_t a = -9223372036854775808LL;
错误/警告是:
error: integer constant is so large that it is unsigned [-Werror]
我认为这个数字超出了范围,所以我尝试了:
std::cout << std::numeric_limits<int64_t>::min() << std::endl;
它输出完全相同的数字!!!所以常数在范围内。
我该如何解决这个错误?