const auto min = -std::numeric_limits<T>::max();
T x = min; // conversion from 'const int' to 'short', possible loss of data
T is a template argument, a short in this case. Unary minus apparently performs integral promotion.
- Why does unary minus perform integral promotion?
- If
autois changed toTno warning is generated, but it should be assigning an int to a short. Why isn't there a warning (it could be VS being fancy)?