mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2024-12-15 04:31:49 +08:00
e7c9de2678
Currently, if you try to use the array version of gdb::unique_xmalloc_ptr (i.e., std::unique_ptr) in order to have access to operator[], like: gdb::unique_xmalloc_ptr<char[]> buf ((char *) xmalloc (10)); return buf[0]; then the build fails, like: /usr/include/c++/5.3.1/bits/unique_ptr.h: In instantiation of ‘std::unique_ptr<_Tp [], _Dp>::~unique_ptr() [with _Tp = char; _Dp = gdb::xfree_deleter<char []>]’: main.c:30:61: required from here /usr/include/c++/5.3.1/bits/unique_ptr.h:484:17: error: no match for call to ‘(std::unique_ptr<char [], gdb::xfree_deleter<char []> >::deleter_type {aka gdb::xfree_deleter<char []>}) (char*&)’ get_deleter()(__ptr); ^ In file included from src/gdb/common/common-defs.h:92:0, from src/gdb/defs.h:28, from src/gdb/main.c:20: src/gdb/common/gdb_unique_ptr.h:34:8: note: candidate: void gdb::xfree_deleter<T>::operator()(T*) const [with T = char []] void operator() (T *ptr) const { xfree (ptr); } ^ src/gdb/common/gdb_unique_ptr.h:34:8: note: no known conversion for argument 1 from ‘char*’ to ‘char (*)[]’ Makefile:1911: recipe for target 'main.o' failed make: *** [main.o] Error 1 The problem is that we're missing an xfree_deleter specialization for arrays. gdb/ChangeLog: 2017-08-10 Pedro Alves <palves@redhat.com> * common/gdb_unique_ptr.h (xfree_deleter<T[]>): Define. |
||
---|---|---|
.. | ||
agent.c | ||
agent.h | ||
ax.def | ||
break-common.h | ||
btrace-common.c | ||
btrace-common.h | ||
buffer.c | ||
buffer.h | ||
byte-vector.h | ||
cleanups.c | ||
cleanups.h | ||
common-debug.c | ||
common-debug.h | ||
common-defs.h | ||
common-exceptions.c | ||
common-exceptions.h | ||
common-gdbthread.h | ||
common-inferior.h | ||
common-regcache.c | ||
common-regcache.h | ||
common-types.h | ||
common-utils.c | ||
common-utils.h | ||
common.host | ||
common.m4 | ||
create-version.sh | ||
def-vector.h | ||
default-init-alloc.h | ||
diagnostics.h | ||
enum-flags.h | ||
environ.c | ||
environ.h | ||
errors.c | ||
errors.h | ||
fileio.c | ||
fileio.h | ||
filestuff.c | ||
filestuff.h | ||
format.c | ||
format.h | ||
function-view.h | ||
gdb_assert.h | ||
gdb_locale.h | ||
gdb_optional.h | ||
gdb_ref_ptr.h | ||
gdb_setjmp.h | ||
gdb_signals.h | ||
gdb_sys_time.h | ||
gdb_termios.h | ||
gdb_unique_ptr.h | ||
gdb_unlinker.h | ||
gdb_vecs.c | ||
gdb_vecs.h | ||
gdb_wait.h | ||
host-defs.h | ||
job-control.c | ||
job-control.h | ||
mingw-strerror.c | ||
new-op.c | ||
offset-type.h | ||
poison.h | ||
posix-strerror.c | ||
preprocessor.h | ||
print-utils.c | ||
print-utils.h | ||
ptid.c | ||
ptid.h | ||
queue.h | ||
refcounted-object.h | ||
rsp-low.c | ||
rsp-low.h | ||
run-time-clock.c | ||
run-time-clock.h | ||
scoped_restore.h | ||
signals-state-save-restore.c | ||
signals-state-save-restore.h | ||
signals.c | ||
symbol.h | ||
traits.h | ||
underlying.h | ||
valid-expr.h | ||
vec.c | ||
vec.h | ||
version.h | ||
x86-xstate.h | ||
xml-utils.c | ||
xml-utils.h |