binutils-gdb/gdb/unittests
Simon Marchi 4b09bb2eff gdb: fix build error in unittests/vec-utils-selftests.c
When building with gcc 9.2.0, I get the following build error:

    In file included from /home/simark/src/binutils-gdb/gdb/unittests/vec-utils-selftests.c:23:
    /home/simark/src/binutils-gdb/gdb/gdbsupport/gdb_vecs.h: In instantiation of ‘T unordered_remove(std::__debug::vector<T>&, typename std::__debug::vector<T>::iterator) [with T = selftests::vector_utils_tests::unordered_remove_tests()::obj; typename std::__debug::vector<T>::iterator = __gnu_debug::_Safe_iterator<__gnu_cxx::__normal_iterator<selftests::vector_utils_tests::unordered_remove_tests()::obj*, std::__cxx1998::vector<selftests::vector_utils_tests::unordered_remove_tests()::obj, std::allocator<selftests::vector_utils_tests::unordered_remove_tests()::obj> > >, std::__debug::vector<selftests::vector_utils_tests::unordered_remove_tests()::obj>, std::random_access_iterator_tag>]’:
    /home/simark/src/binutils-gdb/gdb/unittests/vec-utils-selftests.c:53:26:   required from here
    /home/simark/src/binutils-gdb/gdb/gdbsupport/gdb_vecs.h:53:5: error: implicitly-declared ‘selftests::vector_utils_tests::unordered_remove_tests()::obj::obj(const selftests::vector_utils_tests::unordered_remove_tests()::obj&)’ is deprecated [-Werror=deprecated-copy]
       53 |   T removed = std::move (*it);
          |     ^~~~~~~
    /home/simark/src/binutils-gdb/gdb/unittests/vec-utils-selftests.c:41:10: note: because ‘selftests::vector_utils_tests::unordered_remove_tests()::obj’ has user-provided ‘selftests::vector_utils_tests::unordered_remove_tests()::obj& selftests::vector_utils_tests::unordered_remove_tests()::obj::operator=(const selftests::vector_utils_tests::unordered_remove_tests()::obj&)’
       41 |     obj &operator= (const obj &other)
          |          ^~~~~~~~
    In file included from /home/simark/src/binutils-gdb/gdb/unittests/vec-utils-selftests.c:23:
    /home/simark/src/binutils-gdb/gdb/gdbsupport/gdb_vecs.h:58:10: error: implicitly-declared ‘selftests::vector_utils_tests::unordered_remove_tests()::obj::obj(const selftests::vector_utils_tests::unordered_remove_tests()::obj&)’ is deprecated [-Werror=deprecated-copy]
       58 |   return removed;
          |          ^~~~~~~
    /home/simark/src/binutils-gdb/gdb/unittests/vec-utils-selftests.c:41:10: note: because ‘selftests::vector_utils_tests::unordered_remove_tests()::obj’ has user-provided ‘selftests::vector_utils_tests::unordered_remove_tests()::obj& selftests::vector_utils_tests::unordered_remove_tests()::obj::operator=(const selftests::vector_utils_tests::unordered_remove_tests()::obj&)’
       41 |     obj &operator= (const obj &other)
          |          ^~~~~~~~

I think gcc is just trying to be nice and recommends the good practice
of providing a copy constructor if an assignment operator is provided.

Silence the warning by providing that copy constructor.

gdb/ChangeLog:

	* unittests/vec-utils-selftests.c (unordered_remove_tests::obj):
	Provide explicit default and copy constructor.

Change-Id: I323361b1c120bf8525613b74e7e5983910e002df
2019-11-14 06:51:30 -05:00
..
basic_string_view
optional
array-view-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
child-path-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
cli-utils-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
common-utils-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
copy_bitwise-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
environ-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
format_pieces-selftests.c gdb: Support printf 'z' size modifier 2019-11-12 23:46:41 +00:00
function-view-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
help-doc-selftests.c Add a selftest that checks documentation invariants. 2019-08-07 00:05:34 +02:00
lookup_name_info-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
memory-map-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
memrange-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
mkdir-recursive-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
observable-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
offset-type-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
optional-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
parse-connection-spec-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
ptid-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
rsp-low-selftests.c [gdb] Fix more typos in comments (2) 2019-10-26 09:55:32 +02:00
scoped_fd-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
scoped_mmap-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
scoped_restore-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
string_view-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
style-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
tracepoint-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
unpack-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
utils-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00
vec-utils-selftests.c gdb: fix build error in unittests/vec-utils-selftests.c 2019-11-14 06:51:30 -05:00
xml-utils-selftests.c Rename common to gdbsupport 2019-07-09 07:45:38 -06:00