public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "andrew at ishiboo dot com" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug gdb/29715] New: gdbsupport/default-init-alloc.h fails to compile as C++20, std::allocator::construct() removed
Date: Fri, 21 Oct 2022 18:29:55 +0000	[thread overview]
Message-ID: <bug-29715-4717@http.sourceware.org/bugzilla/> (raw)

https://sourceware.org/bugzilla/show_bug.cgi?id=29715

            Bug ID: 29715
           Summary: gdbsupport/default-init-alloc.h fails to compile as
                    C++20, std::allocator::construct() removed
           Product: gdb
           Version: HEAD
            Status: UNCONFIRMED
          Severity: normal
          Priority: P2
         Component: gdb
          Assignee: unassigned at sourceware dot org
          Reporter: andrew at ishiboo dot com
  Target Milestone: ---

When attempting to build GDB with `-std=c++20`, `default-init-alloc.h` fails to
compile:

../../gdbsupport/../gdbsupport/default-init-alloc.h: In instantiation of 'class
gdb::default_init_allocator<unsigned char, std::allocator<unsigned char> >':
/usr/include/c++/10/bits/stl_vector.h:87:21:   required from 'struct
std::_Vector_base<unsigned char, gdb::default_init_allocator<unsigned char,
std::allocator<unsigned char> > >'
/usr/include/c++/10/bits/stl_vector.h:389:11:   required from 'class
std::vector<unsigned char, gdb::default_init_allocator<unsigned char,
std::allocator<unsigned char> > >'
../../gdbsupport/common-utils.cc:439:25:   required from here
../../gdbsupport/../gdbsupport/default-init-alloc.h:52:12: error: 'construct'
has not been declared in 'std::allocator<unsigned char>'
   52 |   using A::construct;
      |            ^~~~~~~~~

This is because `std::allocator::construct()` was deprecated in C++17 and
removed in C++20. There does not appear to be a more fine-grain feature test
for this, so this class will need to be modified to use the existing code when
<= C++17 and a new implementation using `construct_at()` when >= C++20.

https://en.cppreference.com/w/cpp/memory/allocator/construct

-- 
You are receiving this mail because:
You are on the CC list for the bug.

             reply	other threads:[~2022-10-21 18:29 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-21 18:29 andrew at ishiboo dot com [this message]
2024-01-06 12:41 ` [Bug gdb/29715] " ssbssa at sourceware dot 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-29715-4717@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.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).