public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
* [Bug gdb/29715] New: gdbsupport/default-init-alloc.h fails to compile as C++20, std::allocator::construct() removed
@ 2022-10-21 18:29 andrew at ishiboo dot com
  2024-01-06 12:41 ` [Bug gdb/29715] " ssbssa at sourceware dot org
  0 siblings, 1 reply; 2+ messages in thread
From: andrew at ishiboo dot com @ 2022-10-21 18:29 UTC (permalink / raw)
  To: gdb-prs

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.

^ permalink raw reply	[flat|nested] 2+ messages in thread

* [Bug gdb/29715] gdbsupport/default-init-alloc.h fails to compile as C++20, std::allocator::construct() removed
  2022-10-21 18:29 [Bug gdb/29715] New: gdbsupport/default-init-alloc.h fails to compile as C++20, std::allocator::construct() removed andrew at ishiboo dot com
@ 2024-01-06 12:41 ` ssbssa at sourceware dot org
  0 siblings, 0 replies; 2+ messages in thread
From: ssbssa at sourceware dot org @ 2024-01-06 12:41 UTC (permalink / raw)
  To: gdb-prs

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

Hannes Domani <ssbssa at sourceware dot org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
   Target Milestone|---                         |14.1
                 CC|                            |ssbssa at sourceware dot org
             Status|UNCONFIRMED                 |RESOLVED
         Resolution|---                         |FIXED

--- Comment #1 from Hannes Domani <ssbssa at sourceware dot org> ---
Was fixed by this commit:
https://sourceware.org/git/?p=binutils-gdb.git;a=commitdiff;h=6feae66da1d652a50c1759bae46128087f7dfab0

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

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-01-06 12:41 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-21 18:29 [Bug gdb/29715] New: gdbsupport/default-init-alloc.h fails to compile as C++20, std::allocator::construct() removed andrew at ishiboo dot com
2024-01-06 12:41 ` [Bug gdb/29715] " ssbssa at sourceware dot org

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).