I did: > 2024-07-14 Bruno Haible <br...@clisp.org> > > stdlib: Avoid syntax errors in libstdc++ header files. > * lib/stdlib.in.h: Include <string> before strtol, strtoll, strtoul, or > strtoull gets defined as a macro.
Oops, this causes other compilation errors on macOS 13, 14 and OpenBSD (since the libstdc++ there is not the GNU one) and on mingw 10.0. I don't understand why, but this '#include <string>' is causing other compilation errors on mingw: x86_64-w64-mingw32-g++ -DHAVE_CONFIG_H -DEXEEXT=\".exe\" -DEXEEXT=\".exe\" -I. -I../../gltests -I.. -DGNULIB_STRICT_CHECKING=1 -DIN_GNULIB_TESTS=1 -I. -I../../gltests -I.. -I../../gltests/.. -I../gllib -I../../gltests/../gllib -D_WIN32_WINNT=_WIN32_WINNT_WINXP -I/usr/local/mingw64/include -Wall -Wno-error -g -O2 -MT test-nullptr-c++.o -MD -MP -MF $depbase.Tpo -c -o test-nullptr-c++.o ../../gltests/test-nullptr-c++.cc &&\ mv -f $depbase.Tpo $depbase.Po In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'int std::__cxx11::stoi(const string&, std::size_t*, int)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6620:47: error: 'strtol' is not a member of 'std'; did you mean 'strtol'? 6620 | { return __gnu_cxx::__stoa<long, int>(&std::strtol, "stoi", __str.c_str(), | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:519:16: note: 'strtol' declared here 519 | long __cdecl strtol(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix); | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'long int std::__cxx11::stol(const string&, std::size_t*, int)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6625:36: error: 'strtol' is not a member of 'std'; did you mean 'strtol'? 6625 | { return __gnu_cxx::__stoa(&std::strtol, "stol", __str.c_str(), | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:519:16: note: 'strtol' declared here 519 | long __cdecl strtol(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix); | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'long unsigned int std::__cxx11::stoul(const string&, std::size_t*, int)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6630:36: error: 'strtoul' is not a member of 'std'; did you mean 'strtoul'? 6630 | { return __gnu_cxx::__stoa(&std::strtoul, "stoul", __str.c_str(), | ^~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:521:25: note: 'strtoul' declared here 521 | unsigned long __cdecl strtoul(const char * __restrict__ _Str,char ** __restrict__ _EndPtr,int _Radix); | ^~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'long long int std::__cxx11::stoll(const string&, std::size_t*, int)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6635:36: error: 'strtoll' is not a member of 'std'; did you mean 'strtoll'? 6635 | { return __gnu_cxx::__stoa(&std::strtoll, "stoll", __str.c_str(), | ^~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:733:40: note: 'strtoll' declared here 733 | __MINGW_EXTENSION long long __cdecl strtoll(const char * __restrict__, char ** __restrict, int); | ^~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'long long unsigned int std::__cxx11::stoull(const string&, std::size_t*, int)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6640:36: error: 'strtoull' is not a member of 'std'; did you mean 'strtoull'? 6640 | { return __gnu_cxx::__stoa(&std::strtoull, "stoull", __str.c_str(), | ^~~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:734:49: note: 'strtoull' declared here 734 | __MINGW_EXTENSION unsigned long long __cdecl strtoull(const char * __restrict__, char ** __restrict__, int); | ^~~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'float std::__cxx11::stof(const string&, std::size_t*)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6646:36: error: 'strtof' is not a member of 'std'; did you mean 'strtof'? 6646 | { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx); } | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:491:31: note: 'strtof' declared here 491 | float __cdecl __MINGW_NOTHROW strtof(const char * __restrict__ _Str,char ** __restrict__ _EndPtr) | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'double std::__cxx11::stod(const string&, std::size_t*)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6650:36: error: 'strtod' is not a member of 'std'; did you mean 'strtod'? 6650 | { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx); } | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:484:32: note: 'strtod' declared here 484 | double __cdecl __MINGW_NOTHROW strtod(const char * __restrict__ _Str,char ** __restrict__ _EndPtr) | ^~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:55, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h: In function 'long double std::__cxx11::stold(const string&, std::size_t*)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.h:6654:36: error: 'strtold' is not a member of 'std'; did you mean 'strtold'? 6654 | { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __idx); } | ^~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:502:39: note: 'strtold' declared here 502 | long double __cdecl __MINGW_NOTHROW strtold(const char * __restrict__ , char ** __restrict__ ); | ^~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/string:56, from ../gllib/stdlib.h:128, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/sec_api/stdlib_s.h:9, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/stdlib.h:765, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cstdlib:75, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/stdlib.h:36, from ../gllib/stdlib.h:49, from ../gllib/stdio.h:105, from /usr/x86_64-w64-mingw32/sys-root/mingw/include/locale.h:12, from ../gllib/locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/clocale:42, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/x86_64-w64-mingw32/bits/c++locale.h:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/localefwd.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:41, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.tcc: In function 'std::basic_istream<_CharT, _Traits>& std::operator>>(std::basic_istream<_CharT, _Traits>&, std::__cxx11::basic_string<_CharT, _Traits, _Allocator>&)': /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.tcc:1493:15: error: 'ctype' does not name a type 1493 | typedef ctype<_CharT> __ctype_type; | ^~~~~ /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.tcc:1494:24: error: '__ctype_type' has not been declared 1494 | typedef typename __ctype_type::ctype_base __ctype_base; | ^~~~~~~~~~~~ /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.tcc:1510:21: error: '__ctype_type' does not name a type; did you mean '__ctype_base'? 1510 | const __ctype_type& __ct = use_facet<__ctype_type>(__in.getloc()); | ^~~~~~~~~~~~ | __ctype_base /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.tcc:1516:26: error: '__ct' was not declared in this scope; did you mean '__c'? 1516 | && !__ct.is(__ctype_base::space, | ^~~~ | __c /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/basic_string.tcc:1516:34: error: '__ctype_base' is not a class, namespace, or enumeration 1516 | && !__ct.is(__ctype_base::space, | ^~~~~~~~~~~~ In file included from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/cwchar:44, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/bits/postypes.h:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iosfwd:40, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ios:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/ostream:38, from /usr/lib/gcc/x86_64-w64-mingw32/11/include/c++/iostream:39, from ../../gltests/test-nullptr-c++.cc:25: ../gllib/stdio.h: At global scope: ../gllib/stdio.h:1760:19: warning: 'FILE* _popen(const char*, const char*)' redeclared without dllimport attribute: previous dllimport ignored [-Wattributes] 1760 | _GL_FUNCDECL_SYS (popen, FILE *, | ^~~~~ make[4]: *** [Makefile:27212: test-nullptr-c++.o] Error 1 This patch should fix the regression. 2024-07-14 Bruno Haible <br...@clisp.org> stdlib: Fix last commit on macOS, OpenBSD, mingw. * lib/stdlib.in.h: Don't include <string> with clang, and don't include it on platforms other than Solaris. diff --git a/lib/stdlib.in.h b/lib/stdlib.in.h index ac328eb5e7..e42368eef2 100644 --- a/lib/stdlib.in.h +++ b/lib/stdlib.in.h @@ -117,13 +117,14 @@ struct random_data # include <unistd.h> #endif -#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ +#if ((@GNULIB_STRTOL@ && @REPLACE_STRTOL@) || (@GNULIB_STRTOLL@ && @REPLACE_STRTOLL@) || (@GNULIB_STRTOUL@ && @REPLACE_STRTOUL@) || (@GNULIB_STRTOULL@ && @REPLACE_STRTOULL@)) && defined __cplusplus && !defined GNULIB_NAMESPACE && defined __GNUG__ && !defined __clang__ && defined __sun /* When strtol, strtoll, strtoul, or strtoull is going to be defined as a macro below, this may cause compilation errors later in the libstdc++ header files (that are part of GCC), such as: error: 'rpl_strtol' is not a member of 'std' To avoid this, include the relevant header files here, before these symbols - get defined as macros. */ + get defined as macros. But do so only on Solaris 11 (where it is needed), + not on mingw (where it would cause other compilation errors). */ # include <string> #endif