The code below compiles with a warning:
#include <iostream> #include <limits> #include <cstdint> int main() { int64_t m1 = -std::numeric_limits<int64_t>::min(); int64_t m2 = -m1; std::cout << m1 << std::endl << m2 << std::endl << std::numeric_limits<int64_t>::max() << std::endl; return 0; }(more…)