[Bug libstdc++/60005] New: std::wcstod() doesn't work properly
zizheng.tai at gmail dot com
gcc-bugzilla@gcc.gnu.org
Fri Jan 31 11:14:00 GMT 2014
http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60005
Bug ID: 60005
Summary: std::wcstod() doesn't work properly
Product: gcc
Version: 4.8.0
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: libstdc++
Assignee: unassigned at gcc dot gnu.org
Reporter: zizheng.tai at gmail dot com
According to cppreference, the second argument passed to std::wcstod, which is
a pointer to a pointer to wchar_t (i.e., of type wchar_t **), will
1) be used to store the end of the converted part of the string if the argument
is not nullptr; or
2) not be used at all if the argument is nullptr.
However, when the following code is compiled and linked with mingw32-gcc4.8.0
on 32-bit Windows 7 with command line "g++ a.cpp -std=c++11 -Wall -Wextra", no
warning showed up but the program crashed when running.
// a.cpp
#include <cwchar>
int main()
{
std::wcstod(L"5000", nullptr);
return 0;
}
While the following code has no problem:
// acpp
#include <cwchar>
int main()
{
wchar_t *p = nullptr;
std::wcstod(L"5000", &p);
return 0;
}
More information about the Gcc-bugs
mailing list