From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id B0D9F3858C74; Thu, 13 Jul 2023 17:57:01 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org B0D9F3858C74 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1689271021; bh=wHTHwaDvbj1i6WlH5mr0+wIH+7ZacOjNkEYPM0KUZC8=; h=From:To:Subject:Date:In-Reply-To:References:From; b=TEYsgECxIlk5Uesq5r5PRp2iqUh1dSrRxs4QIzOoHTd3AVaGf6un58wAzflFjfAKY kld3oVTH2/CLquZO/8sJBijKq6DGUTjMrojsENKxPZywrbpbfgGDXrpEImQXo3Ul2a TEiiMOJYY9PUGco9tSVPKOqvSU4vaOf0VHs92iv0= From: "dave.anglin at bell dot net" To: gcc-bugs@gcc.gnu.org Subject: [Bug libstdc++/110653] Support std::stoi etc. without C99 APIs Date: Thu, 13 Jul 2023 17:57:01 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: libstdc++ X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: dave.anglin at bell dot net X-Bugzilla-Status: ASSIGNED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: redi at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D110653 --- Comment #6 from dave.anglin at bell dot net --- On 2023-07-13 1:09 p.m., redi at gcc dot gnu.org wrote: > I'm testing this, which should define std::stof and std::stold for hpux11= .11: > > --- a/libstdc++-v3/include/bits/basic_string.h > +++ b/libstdc++-v3/include/bits/basic_string.h > @@ -4148,12 +4148,14 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 > stod(const string& __str, size_t* __idx =3D 0) > { return __gnu_cxx::__stoa(&std::strtod, "stod", __str.c_str(), __idx= ); } > > -#if _GLIBCXX_USE_C99_STDLIB > +#if _GLIBCXX_USE_C99_STDLIB || _GLIBCXX_HAVE_STRTOF > // NB: strtof vs strtod. > inline float > stof(const string& __str, size_t* __idx =3D 0) > { return __gnu_cxx::__stoa(&std::strtof, "stof", __str.c_str(), __idx= ); } > +#endif > > +#if _GLIBCXX_USE_C99_STDLIB || _GLIBCXX_HAVE_STRTOLD > inline long double > stold(const string& __str, size_t* __idx =3D 0) > { return __gnu_cxx::__stoa(&std::strtold, "stold", __str.c_str(), __i= dx); } > @@ -4161,7 +4163,7 @@ _GLIBCXX_BEGIN_NAMESPACE_CXX11 > inline long double > stold(const string& __str, size_t* __idx =3D 0) > { return std::stod(__str, __idx); } > -#endif // _GLIBCXX_USE_C99_STDLIB > +#endif We get this error with the above: bash-5.1$ gcc/xg++ -Bgcc/ -o xxx xxx.cc -I./hppa64-hp-hpux11.11/libstdc++-v3/include=20 -I./hppa64-hp-hpux11.11/libstdc++-v3/include/hppa64-hp-hpux11.11 -I/home/dave/gnu/gcc/gcc/libstdc++-v3/libsupc++=20 -Lhppa64-hp-hpux11.11/libstdc++-v3/src/.libs -O2 In file included from ./hppa64-hp-hpux11.11/libstdc++-v3/include/string:54, =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0 from xxx.cc:1: ./hppa64-hp-hpux11.11/libstdc++-v3/include/bits/basic_string.h: In function 'long double std::__cxx11::stold(const std::string&, std::size_t*)': ./hppa64-hp-hpux11.11/libstdc++-v3/include/bits/basic_string.h:4161:36: err= or: 'strtold' is not a member of 'std'; did you mean 'strtoll'? =C2=A04161 |=C2=A0=C2=A0 { return __gnu_cxx::__stoa(&std::strtold, "stold"= , __str.c_str(), __idx); } =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 ^~~~~~~ =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0 |=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2= =A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0=C2=A0= =C2=A0=C2=A0=C2=A0 strtoll=