public inbox for gcc-bugs@sourceware.org
help / color / mirror / Atom feed
From: "mccannd at uk dot ibm.com" <gcc-bugzilla@gcc.gnu.org>
To: gcc-bugs@gcc.gnu.org
Subject: [Bug c++/112315] New: 32-bit numeric conversion functions missing - only wstring versions defined
Date: Tue, 31 Oct 2023 14:17:10 +0000	[thread overview]
Message-ID: <bug-112315-4@http.gcc.gnu.org/bugzilla/> (raw)

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.

             reply	other threads:[~2023-10-31 14:17 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-10-31 14:17 mccannd at uk dot ibm.com [this message]
2023-10-31 15:20 ` [Bug c++/112315] " redi at gcc dot gnu.org
2023-10-31 15:35 ` mccannd at uk dot ibm.com
2023-10-31 15:43 ` redi at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-112315-4@http.gcc.gnu.org/bugzilla/ \
    --to=gcc-bugzilla@gcc.gnu.org \
    --cc=gcc-bugs@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).