I have built a Fedora 39 docker image with gcc gcc-c++ glibc-devel.i686 libgcc.i686 libstdc+±devel.i686 in it, and I’m trying to compile some code for 32-bit on the 64-bit system using gcc (as shipped, v13.2).
I was able to reproduce the problem with this simple test case:
File test.cpp
#include <string>
int main()
{
std::string s = std::to_string(42.0f);
}
This compilation work:
/usr/bin/g++ /tmp/build/test.cpp
Building for 32-bit throws an error with Fedora 39 (but it works in Fedora 38):
/usr/bin/g++ -m32 /tmp/build/test.cpp
/tmp/build/test.cpp: In function 'int main()':
/tmp/build/test.cpp:5:33: error: call of overloaded 'to_string(float)' is ambiguous
5 | std::string s = std::to_string(42.0f);
| ~~~~~~~~~~~~~~^~~~~~~
In file included from /usr/include/c++/13/string:54,
from /tmp/build/test.cpp:1:
/usr/include/c++/13/bits/basic_string.h:4150:3: note: candidate: 'std::string std::__cxx11::to_string(int)'
4150 | to_string(int __val)
| ^~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4165:3: note: candidate: 'std::string std::__cxx11::to_string(unsigned int)'
4165 | to_string(unsigned __val)
| ^~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4177:3: note: candidate: 'std::string std::__cxx11::to_string(long int)'
4177 | to_string(long __val)
| ^~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4192:3: note: candidate: 'std::string std::__cxx11::to_string(long unsigned int)'
4192 | to_string(unsigned long __val)
| ^~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4204:3: note: candidate: 'std::string std::__cxx11::to_string(long long int)'
4204 | to_string(long long __val)
| ^~~~~~~~~
/usr/include/c++/13/bits/basic_string.h:4217:3: note: candidate: 'std::string std::__cxx11::to_string(long long unsigned int)'
4217 | to_string(unsigned long long __val)
| ^~~~~~~~~
I have investigated a bit and I can see a difference in the file /usr/include/c++/13/x86_64-redhat-linux/32/bits/c++config.h between Fedora 38 and Fedora 39:
Fedora 38:
#define _GLIBCXX11_USE_C99_STDIO 1
While Fedora 39 has:
/* #undef _GLIBCXX11_USE_C99_STDIO */
There are a few more changes similar to this.
Anyone knows why this change was made? And why it’s not present in the 64-bit version of the header?