In all of Visual Studio 2012, 2010 and 2008 I experience this problem. The following code compiles and runs correctly when compiled in Debug mode. When compiled in Release mode it runs correctly but generates a compile warning. Our project's guidelines do not allow code with warnings to be used.#include <limits>#include <iostream>typedef unsigned int uint32_t;typedef int int32_t;typedef unsigned __int64 uint64_t;template<class T> T convert(){ T r = 4; if (std::numeric_limits<T>::is_signed) { return -r; } else { if (r==0) return 0; } return r;}int main(int, char *[]){ std::cout << "unsigned int: " << std::numeric_limits<unsigned int>::is_signed << std::endl; std::cout << "uint32_t: " << std::numeric_limits<uint32_t>::is_signed << std::endl; std::cout << "unsigned __int64: " << std::numeric_limits<unsigned __int64>::is_signed << std::endl; std::cout << "uint64_t: " << std::numeric_limits<uint64_t>::is_signed << std::endl; std::cout << "uint32_t 4 is " << convert<uint32_t>() << std::endl; std::cout << "int32_t 4 is " << convert<int32_t>() << std::endl; return 0;}
Visual Studio/Team Foundation Server/.NET Framework Tooling Version
Steps to reproduce
Product Language
Operating System
Operating System Language
Actual results
Expected results
Please wait...