gnu/gcc/b624ebefa3a6a591924c0d680772ba89c5cd08d2 libstdc++: Use deleted functions in C++98 mode
We can use deleted functions in C++98 mode if we use pragmas to disable
the -Wc++11-extensions diagnostics. This works with both GCC and Clang.
In some cases this makes the code more robust in C++98 mode because we
were previously not making types copyable at all (e.g.,
_Reuse_or_alloc_node in bits/stl_tree.h) and just relying on testing in
C++11 and later to know we didn't use those functions. In other cases it
gives better diagnostics because we were defining copy constructors and
assignment operators as private
libstdc++-v3/ChangeLog:
* config/io/basic_file_stdio.h (__basic_file): Define copy
constructor and copy assignment operator as deleted for C++98.
* include/bits/stl_bvector.h (vector<bool, A>::data): Define as
deleted for C++98.
* include/bits/stl_tree.h (_Reuse_or_alloc_node): Define copy
constructor as deleted for C++98.
* include/bits/stl_vector.h (_Asan<allocator<T>>::_Reinit):
Define copy constructor and copy assignment operator as deleted
for C++98.
(_Asan<allocator<T>>::_Grow): Likewise.
* testsuite/util/replacement_memory_operators.h
(__gnu_test::counter::scope): Likewise.
* testsuite/util/testsuite_iterators.h (operator,, operator&)
(operator+=, operator-=, operator[]): Define deleted operators
for C++98.
Reviewed-by: Tomasz KamiĆski <tkaminsk@redhat.com>
6 files changed