https://gcc.gnu.org/bugzilla/show_bug.cgi?id=112315
Bug ID: 112315
Summary: 32-bit numeric conversion functions missing - only
wstring versions defined
Product: gcc
Version: 13.2.1
Status: UNCONFIRMED
Severity: normal
Priority: P3
Component: c++
Assignee: unassigned at gcc dot gnu.org
Reporter: mccannd at uk dot ibm.com
Target Milestone: ---
I created the following test program:
====
#include <string>
int main(int argc, char* argv[])
{
std::string X = "my string";
unsigned long long Y = std::stoull(X);
}
====
Using g++ 13.2.1, running the following fails:
$ g++ -m32 cpptest.cpp
cpptest.cpp: In function 'int main(int, char**)':
cpptest.cpp:6:38: error: invalid initialization of reference of type 'const
std::wstring&' {aka 'const std::__cxx11::basic_string<wchar_t>&'} from
expression of type 'std::string' {aka 'std::__cxx11::basic_string<char>'}
6 | unsigned long long Y = std::stoull(X);
| ^
In file included from /usr/include/c++/13/string:54,
from cpptest.cpp:1:
/usr/include/c++/13/bits/basic_string.h:4280:25: note: in passing argument 1 of
'long long unsigned int std::__cxx11::stoull(const std::wstring&, std::size_t*,
int)'
4280 | stoull(const wstring& __str, size_t* __idx = 0, int __base = 10)
| ~~~~~~~~~~~~~~~^~~~~
This appears to be because _GLIBCXX11_USE_C99_STDLIB is no longer defined in
/usr/include/c++/13/x86_64-redhat-linux/32/bits/c++config.h.
The same compilation using g++ 13.0.1 works fine.