What is wrong with the following code (crashes):
#include <string>
#include <iostream>
void foo(std::string str, unsigned long long val)
{
std::cout<< str<< " "<< val<< std::endl; // Crashes if commented as well
}
int main()
{
double d = 30.0;
foo("abc", d);
}
Visual Studio 2012/ Debug/ Win32
It works in x64 as well as if we change the unsigned long long to long long or even unsigned long
This code snippet crashes. In other scenarios the addresses of the function parameters are changed.
I suspect it has something to do with _stol2 that converts the double to unsigned long long
Submitted to Microsoft as a bug (Accepted)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With