https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110653
--- Comment #3 from dave.anglin at bell dot net --- On 2023-07-13 9:46 a.m., redi at gcc dot gnu.org wrote: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=110653 > > --- Comment #2 from Jonathan Wakely <redi at gcc dot gnu.org> --- > Created attachment 55534 > --> https://gcc.gnu.org/bugzilla/attachment.cgi?id=55534&action=edit > libstdc++: std::stoi etc. do not need C99 <stdlib.h> support > > Dave, does this patch work for hppa64-hp-hpux11.11 ? Yes. > > It should allow you to compile + run the code below: > > #include <string> > int main() > { > std::string z = "0"; > return std::stoi(z) + std::stol(z) + std::stoul(z) + std::stoll(z) > + std::stoull(z) + std::stod(z); > } The above code compiles and runs successfully on hppa64-hp-hpux11.11 with the patch. > > I'm not sure if double and long double are the same representation on this > target, but if they are then std::stold("0.0") should work too. Adding std::stold("0.0") to test, we get: bash-5.1$ gcc/xg++ -Bgcc/ -o xxx xxx.cc -I./hppa64-hp-hpux11.11/libstdc++-v3/include -I./hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11 -I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++ -Lhppa64-hp-hpux11.11/libstdc++-v3/src/.libs -O2 xxx.cc: In function 'int main()': xxx.cc:6:48: error: 'stold' is not a member of 'std' 6 | + std::stoull(z) + std::stod(z) + std::stold("0.0"); | ^~~~~ xxx.cc:2:1: note: 'std::stold' is defined in header '<string>'; this is probably fixable by adding '#include <string>' 1 | #include <string> +++ |+#include <string> 2 | int main() On hpux, double and long double have different representations (they are same on linux). hpux11.11 has both strtod and strtold. strtold is checked for: /* Define to 1 if you have the `strtof' function. */ /* #undef HAVE_STRTOF */ /* Define to 1 if you have the `strtold' function. */ #define HAVE_STRTOLD 1 There doesn't seem to be a configure check for strtod.