0e510ab534
167 Commits
Author | SHA1 | Message | Date | |
---|---|---|---|---|
Jonathan Wakely
|
9719769471 |
libstdc++: Fix typos in tests
libstdc++-v3/ChangeLog: * testsuite/21_strings/basic_string/allocator/71964.cc: Fix typo. * testsuite/23_containers/set/allocator/71964.cc: Likewise. |
||
Jonathan Wakely
|
22d34a2a50 |
libstdc++: Implement P1518R2 for container deduction guides
This implements the C++23 P1518R2 proposal "Stop overconstraining allocators in container deduction guides" as a fix for C++17 and C++20 too. The changes allow class template argument deduction to ignore the type of a constructor argument that initializes an allocator_type parameter if the type should be deducible only from the other arguments. So for the constructor vector(const vector&, const allocator_type&) only the first argument is used for deduction, allowing the second argument to be anything that is implicitly convertible to argument_type. Previously deduction would fail or an ill-formed type would be deduced if the second argument wasn't of type allocator_type. The unordered containers do not need changes, because their allocator-extended constructors use the allocator_type alias, which comes from the dependent base class so is already a non-deduced context. libstdc++-v3/ChangeLog: * include/bits/forward_list.h (forward_list): Use non-deduced context for allocator parameter of allocator-extended copy and move constructors. * include/bits/stl_bvector.h (vector<bool>): Likewise. * include/bits/stl_deque.h (deque): Likewise. * include/bits/stl_list.h (list): Likewise. * include/bits/stl_map.h (map): Likewise. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_vector.h (vector): Likewise. * include/bits/stl_queue.h (queue, priority_queue): Do not constrain Allocator template parameter of deduction guides that have a Container parameter. * include/bits/stl_stack.h (stack): Likewise. * include/debug/deque (__gnu_debug::deque): Use non-deduced context for allocator parameter of allocator-extended copy and move constructors. * include/debug/list (__gnu_debug::list): Likewise. * include/debug/map.h (__gnu_debug::map): Likewise. * include/debug/multimap.h (__gnu_debug::multimap): Likewise. * include/debug/multiset.h (__gnu_debug::multiset): Likewise. * include/debug/set.h (__gnu_debug::set): Likewise. * include/debug/vector (__gnu_debug::vector): Likewise. * testsuite/23_containers/deque/cons/deduction.cc: Test class template argument deduction with non-deduced allocator arguments. * testsuite/23_containers/forward_list/cons/deduction.cc: Likewise. * testsuite/23_containers/list/cons/deduction.cc: Likewise. * testsuite/23_containers/map/cons/deduction.cc: Likewise. * testsuite/23_containers/multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/priority_queue/deduction.cc: Likewise. * testsuite/23_containers/queue/deduction.cc: Likewise. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/stack/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. * testsuite/23_containers/vector/cons/deduction.cc: Likewise. |
||
Jonathan Wakely
|
b701f46ea6 |
libstdc++: Skip tests that fail with _GLIBCXX_CONCEPT_CHECKS
The extension that allows implicitly rebinding a container's allocator is not allowed when _GLIBCXX_CONCEPT_CHECKS is defined, so skip the tests for that extension. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * testsuite/23_containers/deque/requirements/explicit_instantiation/3.cc: Do not test implicit allocator rebinding when _GLIBCXX_CONCEPT_CHECKS is defined. * testsuite/23_containers/forward_list/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/list/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/list/requirements/explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/5.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_multiset/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_set/requirements/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/vector/requirements/explicit_instantiation/3.cc: Likewise. |
||
Jonathan Wakely
|
240b01b021 |
libstdc++: Add [[nodiscard]] to iterators and related utilities
This adds [[nodiscard]] throughout <iterator>, as proposed by P2377R0 (with some minor corrections). The attribute is added for all modes from C++11 up, using [[__nodiscard__]] or _GLIBCXX_NODISCARD where C++17 [[nodiscard]] can't be used directly. Signed-off-by: Jonathan Wakely <jwakely@redhat.com> libstdc++-v3/ChangeLog: * include/bits/iterator_concepts.h (iter_move): Add [[nodiscard]]. * include/bits/range_access.h (begin, end, cbegin, cend) (rbegin, rend, crbegin, crend, size, data, ssize): Likewise. * include/bits/ranges_base.h (ranges::begin, ranges::end) (ranges::cbegin, ranges::cend, ranges::rbegin, ranges::rend) (ranges::crbegin, ranges::crend, ranges::size, ranges::ssize) (ranges::empty, ranges::data, ranges::cdata): Likewise. * include/bits/stl_iterator.h (reverse_iterator, __normal_iterator) (back_insert_iterator, front_insert_iterator, insert_iterator) (move_iterator, move_sentinel, common_iterator) (counted_iterator): Likewise. * include/bits/stl_iterator_base_funcs.h (distance, next, prev): Likewise. * include/bits/stream_iterator.h (istream_iterator) (ostream_iterartor): Likewise. * include/bits/streambuf_iterator.h (istreambuf_iterator) (ostreambuf_iterator): Likewise. * include/std/ranges (views::single, views::iota, views::all) (views::filter, views::transform, views::take, views::take_while) (views::drop, views::drop_while, views::join, views::lazy_split) (views::split, views::counted, views::common, views::reverse) (views::elements): Likewise. * testsuite/20_util/rel_ops.cc: Use -Wno-unused-result. * testsuite/24_iterators/move_iterator/greedy_ops.cc: Likewise. * testsuite/24_iterators/normal_iterator/greedy_ops.cc: Likewise. * testsuite/24_iterators/reverse_iterator/2.cc: Likewise. * testsuite/24_iterators/reverse_iterator/greedy_ops.cc: Likewise. * testsuite/21_strings/basic_string/range_access/char/1.cc: Cast result to void. * testsuite/21_strings/basic_string/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/23_containers/array/range_access.cc: Likewise. * testsuite/23_containers/deque/range_access.cc: Likewise. * testsuite/23_containers/forward_list/range_access.cc: Likewise. * testsuite/23_containers/list/range_access.cc: Likewise. * testsuite/23_containers/map/range_access.cc: Likewise. * testsuite/23_containers/multimap/range_access.cc: Likewise. * testsuite/23_containers/multiset/range_access.cc: Likewise. * testsuite/23_containers/set/range_access.cc: Likewise. * testsuite/23_containers/unordered_map/range_access.cc: Likewise. * testsuite/23_containers/unordered_multimap/range_access.cc: Likewise. * testsuite/23_containers/unordered_multiset/range_access.cc: Likewise. * testsuite/23_containers/unordered_set/range_access.cc: Likewise. * testsuite/23_containers/vector/range_access.cc: Likewise. * testsuite/24_iterators/customization_points/iter_move.cc: Likewise. * testsuite/24_iterators/istream_iterator/sentinel.cc: Likewise. * testsuite/24_iterators/istreambuf_iterator/sentinel.cc: Likewise. * testsuite/24_iterators/move_iterator/dr2061.cc: Likewise. * testsuite/24_iterators/operations/prev_neg.cc: Likewise. * testsuite/24_iterators/ostreambuf_iterator/2.cc: Likewise. * testsuite/24_iterators/range_access/range_access.cc: Likewise. * testsuite/24_iterators/range_operations/100768.cc: Likewise. * testsuite/26_numerics/valarray/range_access2.cc: Likewise. * testsuite/28_regex/range_access.cc: Likewise. * testsuite/experimental/string_view/range_access/char/1.cc: Likewise. * testsuite/experimental/string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/ext/vstring/range_access.cc: Likewise. * testsuite/std/ranges/adaptors/take.cc: Likewise. * testsuite/std/ranges/p2259.cc: Likewise. |
||
Patrick Palka
|
7da4eae3dc |
c++: excessive instantiation during CTAD [PR101174]
We set DECL_CONTEXT on implicitly generated deduction guides so that their access is consistent with that of the constructor. But this apparently leads to excessive instantiation in some cases, ultimately because instantiation of a deduction guide should be independent of instantiation of the resulting class specialization, but setting the DECL_CONTEXT of the former to the latter breaks this independence. To fix this, this patch makes push_access_scope handle artificial deduction guides specifically rather than setting their DECL_CONTEXT in build_deduction_guide. We could alternatively make the class befriend the guide via DECL_BEFRIENDING_CLASSES, but that wouldn't be a complete fix and would break class-deduction-access3.C below since friendship isn't transitive. PR c++/101174 gcc/cp/ChangeLog: * pt.c (push_access_scope): For artificial deduction guides, set the access scope to that of the constructor. (pop_access_scope): Likewise. (build_deduction_guide): Don't set DECL_CONTEXT on the guide. libstdc++-v3/ChangeLog: * testsuite/23_containers/multiset/cons/deduction.cc: Uncomment CTAD example that was rejected by this bug. * testsuite/23_containers/set/cons/deduction.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction-access3.C: New test. * g++.dg/cpp1z/class-deduction91.C: New test. |
||
Patrick Palka
|
3eecc1db4c |
c++: CTAD and deduction guide selection [PR86439]
During CTAD, we select the best viable deduction guide using build_new_function_call, which performs overload resolution on the set of candidate guides and then forms a call to the guide. As the PR points out, this latter step is unnecessary and occasionally incorrect since a call to the selected guide may be ill-formed, or forming the call may have side effects such as prematurely deducing the type of a {}. So this patch introduces a specialized subroutine based on build_new_function_call that stops short of building a call to the selected function, and makes do_class_deduction use this subroutine instead. And since a call is no longer built, do_class_deduction doesn't need to set tf_decltype or cp_unevaluated_operand anymore. This change causes us to reject some container CTAD examples in the libstdc++ testsuite due to deduction failure for {}, which AFAICT is the correct behavior. Previously in e.g. the first removed example std::map{{std::pair{1, 2.0}, {2, 3.0}, {3, 4.0}}, {}}, the type of the {} would get deduced to less<int> as a side effect of forming a call to the chosen guide template<typename _Key, typename _Tp, typename _Compare = less<_Key>, typename _Allocator = allocator<pair<const _Key, _Tp>>> map(initializer_list<pair<_Key, _Tp>>, _Compare = _Compare(), _Allocator = _Allocator()) -> map<_Key, _Tp, _Compare, _Allocator>; which made later overload resolution for the constructor call unambiguous. Now, the type of the {} remains undeduced until constructor overload resolution, and we complain about ambiguity for the two equally good constructor candidates map(initializer_list<value_type>, const _Compare& = _Compare(), const allocator_type& = allocator_type()) map(initializer_list<value_type>, const allocator_type&). This patch fixes these problematic container CTAD examples by giving the {} an appropriate concrete type. Two of these adjusted CTAD examples (one for std::set and one for std::multiset) end up triggering an unrelated CTAD bug on trunk, PR101174, so these two adjusted examples are commented out for now. PR c++/86439 gcc/cp/ChangeLog: * call.c (print_error_for_call_failure): Constify 'args' parameter. (perform_dguide_overload_resolution): Define. * cp-tree.h: (perform_dguide_overload_resolution): Declare. * pt.c (do_class_deduction): Use perform_dguide_overload_resolution instead of build_new_function_call. Don't use tf_decltype or set cp_unevaluated_operand. Remove unnecessary NULL_TREE tests. libstdc++-v3/ChangeLog: * testsuite/23_containers/map/cons/deduction.cc: Replace ambiguous CTAD examples. * testsuite/23_containers/multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. Mention one of the replaced examples is broken due to PR101174. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Replace ambiguous CTAD examples. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. gcc/testsuite/ChangeLog: * g++.dg/cpp1z/class-deduction88.C: New test. * g++.dg/cpp1z/class-deduction89.C: New test. * g++.dg/cpp1z/class-deduction90.C: New test. |
||
Patrick Palka
|
ac0bc21bd6 |
c++: value-init vs zero-init in expand_aggr_init_1 [PR65816]
In the case of value-initializing an object of class type T, [dcl.init.general]/8 says: - if T has either no default constructor ([class.default.ctor]) or a default constructor that is user-provided or deleted, then the object is default-initialized; - otherwise, the object is zero-initialized and ... if T has a non-trivial default constructor, the object is default-initialized; But when determining whether to first zero-initialize the object, expand_aggr_init_1 incorrectly considers the user-providedness of _all_ constructors rather than only that of the _default_ constructors. This causes us to skip the zero-initialization step when the class type has a defaulted default constructor alongside a user-defined constructor. It seems the predicate type_has_non_user_provided_default_constructor accurately captures the above rule for when to first perform a zero-initialization during value-initialization, so this patch adjusts expand_aggr_init_1 to use this predicate instead. PR c++/65816 gcc/cp/ChangeLog: * init.c (expand_aggr_init_1): Check type_has_non_user_provided_default_constructor instead of type_has_user_provided_constructor. gcc/testsuite/ChangeLog: * g++.dg/cpp0x/constexpr-delegating3.C: New test. * g++.dg/cpp0x/dc10.C: New test. * g++.dg/cpp0x/initlist-base4.C: New test. * g++.dg/cpp2a/constexpr-init22.C: New test. libstdc++-v3/ChangeLog: * testsuite/23_containers/deque/allocator/default_init.cc, testsuite/23_containers/forward_list/allocator/default_init.cc, testsuite/23_containers/list/allocator/default_init.cc, testsuite/23_containers/map/allocator/default_init.cc, testsuite/23_containers/set/allocator/default_init.cc, testsuite/23_containers/vector/allocator/default_init.cc, testsuite/23_containers/vector/bool/allocator/default_init.cc: Remove xfail. |
||
Jonathan Wakely
|
7c85abec76 |
libstdc++: Remove redundant -std=gnu++17 option from containers tests
GCC defaults to -std=gnu++17 now anyway, and using it explicitly in the dg-options directive prevents running these tests with different modes such as -std=c++17 or -std=gnu++20. libstdc++-v3/ChangeLog: * testsuite/23_containers/array/cons/deduction.cc: Remove -std=gnu++17 from dg-options directive. * testsuite/23_containers/array/cons/deduction_neg.cc: Likewise. * testsuite/23_containers/array/element_access/constexpr_c++17.cc: Likewise. * testsuite/23_containers/array/requirements/constexpr_iter.cc: Likewise. * testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc: Likewise. * testsuite/23_containers/deque/cons/deduction.cc: Likewise. * testsuite/23_containers/deque/modifiers/emplace/cxx17_return.cc: Likewise. * testsuite/23_containers/forward_list/cons/deduction.cc: Likewise. * testsuite/23_containers/forward_list/modifiers/emplace_cxx17_return.cc: Likewise. * testsuite/23_containers/list/cons/deduction.cc: Likewise. * testsuite/23_containers/list/modifiers/emplace/cxx17_return.cc: Likewise. * testsuite/23_containers/map/cons/deduction.cc: Likewise. * testsuite/23_containers/map/modifiers/extract.cc: Likewise. * testsuite/23_containers/map/modifiers/insert/83226.cc: Likewise. * testsuite/23_containers/map/modifiers/insert_or_assign/1.cc: Likewise. * testsuite/23_containers/map/modifiers/merge.cc: Likewise. * testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise. * testsuite/23_containers/multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/multimap/modifiers/merge.cc: Likewise. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/multiset/modifiers/merge.cc: Likewise. * testsuite/23_containers/priority_queue/deduction.cc: Likewise. * testsuite/23_containers/queue/deduction.cc: Likewise. * testsuite/23_containers/queue/members/emplace_cxx17_return.cc: Likewise. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/set/modifiers/extract.cc: Likewise. * testsuite/23_containers/set/modifiers/merge.cc: Likewise. * testsuite/23_containers/set/modifiers/node_swap.cc: Likewise. * testsuite/23_containers/stack/deduction.cc: Likewise. * testsuite/23_containers/stack/members/emplace_cxx17_return.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/insert_or_assign.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/try_emplace.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/merge.cc: Likewise. * testsuite/23_containers/vector/bool/emplace_cxx17_return.cc: Likewise. * testsuite/23_containers/vector/cons/89164_c++17.cc: Likewise. * testsuite/23_containers/vector/cons/deduction.cc: Likewise. * testsuite/23_containers/vector/modifiers/emplace/cxx17_return.cc: Likewise. |
||
Jonathan Wakely
|
7a4e52e44a |
libstdc++: Remove redundant -std=gnu++17 option from PMR tests
GCC defaults to -std=gnu++17 now anyway, and using it explicitly in the dg-options directive prevents running these tests with different modes such as -std=c++17 or -std=gnu++20. libstdc++-v3/ChangeLog: * testsuite/20_util/memory_resource/1.cc: Remove -std=gnu++17 from dg-options directive. * testsuite/20_util/memory_resource/2.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/1.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/93208.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/allocate.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/deallocate.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/release.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/upstream_resource.cc: Likewise. * testsuite/20_util/polymorphic_allocator/1.cc: Likewise. * testsuite/20_util/polymorphic_allocator/construct_pair.cc: Likewise. * testsuite/20_util/polymorphic_allocator/resource.cc: Likewise. * testsuite/20_util/polymorphic_allocator/select.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/allocate.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/allocate_single.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/cons.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/cons_single.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/is_equal.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/multithreaded.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/options.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/release.cc: Likewise. * testsuite/20_util/synchronized_pool_resource/release_single.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/allocate-max-chunks.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/allocate.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/cons.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/is_equal.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/options.cc: Likewise. * testsuite/20_util/unsynchronized_pool_resource/release.cc: Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: Likewise. * testsuite/23_containers/deque/types/pmr_typedefs.cc: Likewise. * testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/vector/pmr_typedefs.cc: Likewise. * testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: Likewise. * testsuite/28_regex/match_results/pmr_typedefs.cc: Likewise. |
||
Jakub Jelinek
|
99dee82307 | Update copyright years. | ||
François Dumont
|
90bf60c3c2 |
libstdc++: _Rb_tree code cleanup, remove lambdas
Use new template parameters to replace usage of lambdas to move or not tree values on copy. libstdc++-v3/ChangeLog: * include/bits/move.h (_GLIBCXX_FWDREF): New. * include/bits/stl_tree.h: Adapt to use latter. (_Rb_tree<>::_M_clone_node): Add _MoveValue template parameter. (_Rb_tree<>::_M_mbegin): New. (_Rb_tree<>::_M_begin): Use latter. (_Rb_tree<>::_M_copy): Add _MoveValues template parameter. * testsuite/23_containers/map/allocator/move_cons.cc: New test. * testsuite/23_containers/multimap/allocator/move_cons.cc: New test. * testsuite/23_containers/multiset/allocator/move_cons.cc: New test. * testsuite/23_containers/set/allocator/move_cons.cc: New test. |
||
Jonathan Wakely
|
13feb0234b |
libstdc++: Avoid warnings in tests
This fixes some warnings emitted when testing with warning flags added. Some of these are only necessary when testing with -Wsystem-headers, but either way it cleans up the tests to be less noisy under non-default flags. libstdc++-v3/ChangeLog: * testsuite/18_support/96817.cc: Avoid -Wunused warnings. * testsuite/20_util/any/assign/2.cc: Likewise. * testsuite/20_util/any/cons/2.cc: Likewise. * testsuite/20_util/align/1.cc: Avoid -Wsign-compare warning. * testsuite/20_util/function/65760.cc: Avoid -Wunused warning. * testsuite/20_util/function/1.cc: Avoid -Wcatch-value warning. * testsuite/20_util/function/cons/move_target.cc: Avoid -Wunused warning. * testsuite/20_util/headers/memory/synopsis.cc: Add exception specification. * testsuite/20_util/monotonic_buffer_resource/allocate.cc: Avoid -Wsign-compare warning. * testsuite/20_util/tuple/cons/deduction.cc: Avoid -Wunused warning. * testsuite/20_util/specialized_algorithms/uninitialized_copy/808590-cxx11.cc: Avoid -Wdeprecated-copy warning. * testsuite/21_strings/basic_string/56166.cc: Avoid -Wcatch-value warning. * testsuite/21_strings/basic_string/numeric_conversions/char/stod.cc: Avoid -Wcatch-value warnings. * testsuite/21_strings/basic_string/numeric_conversions/char/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/char/stoull.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stod.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stof.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoi.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stol.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stold.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoll.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoul.cc: Likewise. * testsuite/21_strings/basic_string/numeric_conversions/wchar_t/stoull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/nonnull.cc: Prune additional diagnostics. * testsuite/21_strings/basic_string_view/operations/find/char/nonnull.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/nonnull.cc: Likewise. * testsuite/21_strings/headers/string/synopsis.cc: Add exception specifications. * testsuite/22_locale/locale/cons/12352.cc: Define sized delete operators to avoid warnings. * testsuite/23_containers/deque/modifiers/swap/1.cc: Add exception specification. * testsuite/23_containers/forward_list/cons/11.cc: Avoid -Wdeprecated-copy warning. * testsuite/23_containers/headers/bitset/synopsis.cc: Add exception specification. * testsuite/23_containers/headers/deque/synopsis.cc: Likewise. * testsuite/23_containers/headers/forward_list/synopsis.cc: Likewise. * testsuite/23_containers/headers/list/synopsis.cc: Likewise. * testsuite/23_containers/headers/map/synopsis.cc: Likewise. * testsuite/23_containers/headers/queue/synopsis.cc: Likewise. * testsuite/23_containers/headers/set/synopsis.cc: Likewise. * testsuite/23_containers/headers/vector/synopsis.cc: Likewise. * testsuite/23_containers/list/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/map/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/multiset/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/set/modifiers/swap/1.cc: Likewise. * testsuite/23_containers/unordered_set/56267-2.cc: Avoid -Wdeprecated-copy warning. * testsuite/23_containers/vector/bool/23632.cc: Avoid -Wempty-body warning. * testsuite/23_containers/vector/modifiers/swap/1.cc: Add exception specification. * testsuite/25_algorithms/heap/moveable2.cc: Fix misplaced parentheses around arguments. * testsuite/25_algorithms/sample/1.cc: Use return value. * testsuite/25_algorithms/search/searcher.cc: Avoid -Wunused warnings. * testsuite/27_io/basic_ostream/exceptions/char/9561.cc: Likewise. * testsuite/27_io/basic_ostream/exceptions/wchar_t/9561.cc: Likewise. * testsuite/27_io/filesystem/operations/remove_all.cc: Avoid -Wsign-compare warning. * testsuite/experimental/any/assign/2.cc: Avoid -Wunused warnings. * testsuite/experimental/any/cons/2.cc: Likewise. * testsuite/experimental/filesystem/operations/remove_all.cc: Avoid -Wign-compare warning. * testsuite/experimental/memory/observer_ptr/cons/cons.cc: Likewise. * testsuite/experimental/memory_resource/null_memory_resource.cc: Likewise. * testsuite/experimental/source_location/1.cc: Avoid -Waddress warning. * testsuite/ext/pod_char_traits.cc: Avoid -Wunused warning. * testsuite/ext/vstring/modifiers/clear/56166.cc: Avoid -Wcatch-value. * testsuite/std/concepts/concepts.lang/concept.swappable/swap.cc: Avoid -Wunused warning. * testsuite/std/concepts/concepts.lang/concept.swappable/swappable.cc: Likewise. * testsuite/tr1/2_general_utilities/shared_ptr/cons/43820_neg.cc: Prune additional warnings. * testsuite/tr1/3_function_objects/function/1.cc: Avoid -Wcatch-value warning. * testsuite/util/replacement_memory_operators.h: Define sized delete to avoid warnings. * testsuite/util/testsuite_api.h (_NonDefaultConstructible): Add user-declared assignment operator to stop -Wdeprecated-copy warnings. * testsuite/util/testsuite_containers.h: Avoid -Wunused warning. * testsuite/util/testsuite_iterators.h: Avoid -Wsign-compare warnings. * testsuite/util/testsuite_new_operators.h: Define sized deleted. |
||
Jonathan Wakely
|
24f2764521 |
libstdc++: Remove tests for self-move debug assertions
I recently removed the debug mode checks for self-move assignment, which means these tests now fail when _GLIBCXX_DEBUG is added to the options or when the check-debug target is used. Remove all the tests. libstdc++-v3/ChangeLog: * testsuite/21_strings/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/21_strings/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/deque/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/deque/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/forward_list/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/forward_list/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/list/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/list/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/map/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/map/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/multimap/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/multimap/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/multiset/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/multiset/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/set/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/set/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_map/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_map/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multimap/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multimap/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multiset/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_multiset/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_set/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/unordered_set/debug/self_move_assign_neg.cc: Removed. * testsuite/23_containers/vector/debug/iterator_self_move_assign_neg.cc: Removed. * testsuite/23_containers/vector/debug/self_move_assign_neg.cc: Removed. |
||
Jonathan Wakely
|
c2fb0a1a2e |
libstdc++: Make self-move well-defined for containers [PR 85828]
The C++ LWG recently confirmed that self-move assignment should not have undefined behaviour for standard containers (see the proposed resolution of LWG 2839). The result should be a valid but unspecified value, just like other times when a container is moved from. Our std::list, std::__cxx11::basic_string and unordered containers all have bugs which result in undefined behaviour. For std::list the problem is that we clear the previous contents using _M_clear() instead of clear(). This means the _M_next, _M_prev and _M_size members are not zeroed, and so after we "update" them (with their existing values), we are left with dangling pointers and a non-zero size, but no elements. For the unordered containers the problem is similar. _Hashtable first deallocates the existing contents, then takes ownership of the pointers from the RHS object (which has just had its contents deallocated so the pointers are dangling). For std::basic_string it's a little more subtle. When the string is local (i.e. fits in the SSO buffer) we use char_traits::copy to copy the contents from this->data() to __rhs.data(). When &__rhs == this that copy violates the precondition that the ranges don't overlap. We only need to check for self-move for this case where it's local, because the only other case that can be true for self-move is that it's non-local but the allocators compare equal. In that case the data pointer is neither deallocated nor leaked, so the result is well-defined. This patch also makes a small optimization for std::deque move assignment, to use the efficient move when is_always_equal is false, but the allocators compare equal at runtime. Finally, we need to remove all the Debug Mode checks which abort the program when a self-move is detected, because it's not undefined to do that. Before PR 85828 can be closed we should also look into fixing std::shuffle so it doesn't do any redundant self-swaps. libstdc++-v3/ChangeLog: PR libstdc++/85828 * include/bits/basic_string.h (operator=(basic_string&&)): Check for self-move before copying with char_traits::copy. * include/bits/hashtable.h (operator=(_Hashtable&&)): Check for self-move. * include/bits/stl_deque.h (_M_move_assign1(deque&&, false_type)): Check for equal allocators. * include/bits/stl_list.h (_M_move_assign(list&&, true_type)): Call clear() instead of _M_clear(). * include/debug/formatter.h (__msg_self_move_assign): Change comment. * include/debug/macros.h (__glibcxx_check_self_move_assign): (_GLIBCXX_DEBUG_VERIFY): Remove. * include/debug/safe_container.h (operator=(_Safe_container&&)): Remove assertion check for safe move and make it well-defined. * include/debug/safe_iterator.h (operator=(_Safe_iterator&&)): Remove assertion check for self-move. * include/debug/safe_local_iterator.h (operator=(_Safe_local_iterator&&)): Likewise. * testsuite/21_strings/basic_string/cons/char/self_move.cc: New test. * testsuite/23_containers/deque/cons/self_move.cc: New test. * testsuite/23_containers/forward_list/cons/self_move.cc: New test. * testsuite/23_containers/list/cons/self_move.cc: New test. * testsuite/23_containers/set/cons/self_move.cc: New test. * testsuite/23_containers/unordered_set/cons/self_move.cc: New test. * testsuite/23_containers/vector/cons/self_move.cc: New test. |
||
Jonathan Wakely
|
6458742a15 |
libstdc++: Ensure c++NN effective target present in all C++17 tests
Also reorder some directives so that the dg-options setting -std=gnu++17 comes before the dg-do that requires c++17. libstdc++-v3/ChangeLog: * testsuite/17_intro/headers/c++2017/all_attributes.cc: Add c++17 effective-target. * testsuite/17_intro/headers/c++2017/all_no_exceptions.cc: Likewise. * testsuite/17_intro/headers/c++2017/all_no_rtti.cc: Likewise. * testsuite/17_intro/headers/c++2017/all_pedantic_errors.cc: Likewise. * testsuite/17_intro/headers/c++2017/operator_names.cc: Likewise. * testsuite/17_intro/headers/c++2017/stdc++.cc: Likewise. * testsuite/17_intro/headers/c++2017/stdc++_multiple_inclusion.cc: Likewise. * testsuite/18_support/uncaught_exceptions/uncaught_exceptions.cc: Likewise. * testsuite/19_diagnostics/error_code/is_error_code_v.cc: Likewise. * testsuite/20_util/any/assign/1.cc: Likewise. * testsuite/20_util/any/assign/2.cc: Likewise. * testsuite/20_util/any/assign/emplace.cc: Likewise. * testsuite/20_util/any/assign/exception.cc: Likewise. * testsuite/20_util/any/assign/self.cc: Likewise. * testsuite/20_util/any/cons/1.cc: Likewise. * testsuite/20_util/any/cons/2.cc: Likewise. * testsuite/20_util/any/cons/aligned.cc: Likewise. * testsuite/20_util/any/cons/explicit.cc: Likewise. * testsuite/20_util/any/cons/in_place.cc: Likewise. * testsuite/20_util/any/cons/nontrivial.cc: Likewise. * testsuite/20_util/any/make_any.cc: Likewise. * testsuite/20_util/any/misc/any_cast.cc: Likewise. * testsuite/20_util/any/misc/any_cast_no_rtti.cc: Likewise. * testsuite/20_util/any/misc/swap.cc: Likewise. * testsuite/20_util/any/modifiers/1.cc: Likewise. * testsuite/20_util/any/observers/type.cc: Likewise. * testsuite/20_util/any/requirements.cc: Likewise. * testsuite/20_util/any/typedefs.cc: Likewise. * testsuite/20_util/as_const/1.cc: Likewise. * testsuite/20_util/as_const/rvalue_neg.cc: Likewise. * testsuite/20_util/bind/is_placeholder_v.cc: Likewise. * testsuite/20_util/bool_constant/requirements.cc: Likewise. * testsuite/20_util/duration/requirements/treat_as_floating_point_v.cc: Likewise. * testsuite/20_util/duration_cast/rounding.cc: Likewise. * testsuite/20_util/enable_shared_from_this/members/weak_from_this.cc: Likewise. * testsuite/20_util/function_objects/invoke/59768.cc: Likewise. * testsuite/20_util/function_objects/not_fn/1.cc: Likewise. * testsuite/20_util/function_objects/searchers.cc: Likewise. * testsuite/20_util/in_place/requirements.cc: Likewise. * testsuite/20_util/is_invocable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_invocable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_invocable/value.cc: Likewise. * testsuite/20_util/is_nothrow_invocable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_invocable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable/value.cc: Likewise. * testsuite/20_util/is_nothrow_swappable_with/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_nothrow_swappable_with/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_nothrow_swappable_with/value.cc: Likewise. * testsuite/20_util/is_swappable/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_swappable/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_swappable/value.cc: Likewise. * testsuite/20_util/is_swappable_with/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/is_swappable_with/requirements/typedefs.cc: Likewise. * testsuite/20_util/is_swappable_with/value.cc: Likewise. * testsuite/20_util/logical_traits/requirements/explicit_instantiation.cc: Likewise. * testsuite/20_util/logical_traits/requirements/typedefs.cc: Likewise. * testsuite/20_util/logical_traits/value.cc: Likewise. * testsuite/20_util/optional/constexpr/make_optional.cc: Likewise. * testsuite/20_util/optional/constexpr/observers/2.cc: Likewise. * testsuite/20_util/optional/constexpr/observers/3.cc: Likewise. * testsuite/20_util/optional/hash.cc: Likewise. * testsuite/20_util/pair/swap_cxx17.cc: Likewise. * testsuite/20_util/ratio/requirements/ratio_equal_v.cc: Likewise. * testsuite/20_util/shared_ptr/requirements/weak_type.cc: Likewise. * testsuite/20_util/specialized_algorithms/memory_management_tools/1.cc: Likewise. * testsuite/20_util/tuple/apply/1.cc: Likewise. * testsuite/20_util/tuple/make_from_tuple/1.cc: Likewise. * testsuite/20_util/tuple/swap_cxx17.cc: Likewise. * testsuite/20_util/tuple/tuple_size_v.cc: Likewise. * testsuite/20_util/unique_ptr/specialized_algorithms/swap_cxx17.cc: Likewise. * testsuite/20_util/uses_allocator/requirements/uses_allocator_v.cc: Likewise. * testsuite/20_util/variant/any.cc: Likewise. * testsuite/20_util/variant/compile.cc: Likewise. * testsuite/20_util/variant/hash.cc: Likewise. * testsuite/20_util/variant/index_type.cc: Likewise. * testsuite/20_util/variant/run.cc: Likewise. * testsuite/20_util/void_t/1.cc: Likewise. * testsuite/21_strings/basic_string/79162.cc: Likewise. * testsuite/21_strings/basic_string/cons/char/7.cc: Likewise. * testsuite/21_strings/basic_string/cons/wchar_t/7.cc: Likewise. * testsuite/21_strings/basic_string/lwg2758.cc: Likewise. * testsuite/21_strings/basic_string/lwg2946.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/append/char/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/append/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/char/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/assign/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/char/3.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/insert/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/char/7.cc: Likewise. * testsuite/21_strings/basic_string/modifiers/replace/wchar_t/7.cc: Likewise. * testsuite/21_strings/basic_string/operations/compare/char/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/compare/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/char/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/data/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string/operations/find/char/5.cc: Likewise. * testsuite/21_strings/basic_string/operations/find/wchar_t/5.cc: Likewise. * testsuite/21_strings/basic_string/operators/char/5.cc: Likewise. * testsuite/21_strings/basic_string/operators/wchar_t/5.cc: Likewise. * testsuite/21_strings/basic_string_view/capacity/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/cons/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/empty.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/char/front_back.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/empty.cc: Likewise. * testsuite/21_strings/basic_string_view/element_access/wchar_t/front_back.cc: Likewise. * testsuite/21_strings/basic_string_view/include.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/pod/10081-out.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/inserters/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/types-char8_t.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/types.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/values-char8_t.cc: Likewise. * testsuite/21_strings/basic_string_view/literals/values.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_prefix/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/modifiers/remove_suffix/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/char/13650.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/compare/wchar_t/13650.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/copy/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/data/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/data/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/char/4.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/find/wchar_t/4.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/char/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/2.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/rfind/wchar_t/3.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/string_conversion/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/operations/substr/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/range_access/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char16_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char32_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/char8_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/explicit_instantiation/wchar_t/1.cc: Likewise. * testsuite/21_strings/basic_string_view/requirements/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/typedefs.cc: Likewise. * testsuite/21_strings/basic_string_view/types/1.cc: Likewise. * testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc: Likewise. * testsuite/23_containers/map/modifiers/extract.cc: Likewise. * testsuite/23_containers/map/modifiers/insert_or_assign/1.cc: Likewise. * testsuite/23_containers/map/modifiers/merge.cc: Likewise. * testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/multimap/modifiers/merge.cc: Likewise. * testsuite/23_containers/multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/multiset/modifiers/merge.cc: Likewise. * testsuite/23_containers/set/modifiers/extract.cc: Likewise. * testsuite/23_containers/set/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/insert_or_assign.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/try_emplace.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/merge.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/merge.cc: Likewise. * testsuite/24_iterators/headers/iterator/range_access_c++17.cc: Likewise. * testsuite/24_iterators/headers/iterator/synopsis_c++17.cc: Likewise. * testsuite/25_algorithms/clamp/1.cc: Likewise. * testsuite/25_algorithms/clamp/2.cc: Likewise. * testsuite/25_algorithms/clamp/constexpr.cc: Likewise. * testsuite/25_algorithms/clamp/requirements/explicit_instantiation/1.cc: Likewise. * testsuite/25_algorithms/clamp/requirements/explicit_instantiation/pod.cc: Likewise. * testsuite/26_numerics/headers/cmath/functions_std_c++17.cc: Likewise. * testsuite/26_numerics/headers/cmath/special_functions_global.cc: Likewise. * testsuite/27_io/basic_ostream/inserters_other/char/lwg2221.cc: Likewise. * testsuite/29_atomics/atomic/is_always_lock_free.cc: Likewise. * testsuite/29_atomics/atomic_integral/is_always_lock_free.cc: Likewise. * testsuite/30_threads/shared_lock/70766.cc: Likewise. * testsuite/30_threads/shared_mutex/cons/1.cc: Likewise. * testsuite/30_threads/shared_mutex/cons/assign_neg.cc: Likewise. * testsuite/30_threads/shared_mutex/cons/copy_neg.cc: Likewise. * testsuite/30_threads/shared_mutex/requirements/standard_layout.cc: Likewise. * testsuite/30_threads/shared_mutex/try_lock/1.cc: Likewise. * testsuite/30_threads/shared_mutex/try_lock/2.cc: Likewise. * testsuite/30_threads/shared_mutex/unlock/1.cc: Likewise. |
||
François Dumont
|
c832cf1c1d |
libstdc++: Fix [multi]map/[multi]set move constructors noexcept qualification
Container move constructors shall not consider their allocator move constructor qualification. libstdc++-v3/ChangeLog: * include/bits/stl_tree.h (_Rb_tree_impl(_Rb_tree_impl&&)): Add noexcept qualification based only on _Compare one. * testsuite/23_containers/map/cons/noexcept_move_construct.cc: Add static asserts. * testsuite/23_containers/multimap/cons/noexcept_move_construct.cc: Likewise. * testsuite/23_containers/multiset/cons/noexcept_move_construct.cc: Likewise. * testsuite/23_containers/set/cons/noexcept_move_construct.cc: Likewise. |
||
Jonathan Wakely
|
eca833b812 |
libstdc++: Make debug containers prefer copy ctor to base ctor (PR 90102)
When given a type which can convert to any container-like type, the C(const C&) copy constructor and C(const C::_Base&) converting constructor are ambiguous. This change replaces the converting constructor's parameter with a reference_wrapper-like type so that calling that constructor requires an additional user-defined conversion. This gives it a lower rank than the copy constructor, avoiding the ambiguity. While testing this change I discovered that __gnu_debug::forward_list doesn't have a convering constructor from the std::forward_list base, so this adds it. We should probably consider whether the converting constructors should be 'explicit' but I'm not changing that now. libstdc++-v3/ChangeLog: PR libstdc++/90102 * include/debug/deque (deque(const _Base&)): Replace parameter with a struct that wraps a const _Base&. * include/debug/forward_list (forward_list(_Base_ref)): New constructor. * include/debug/list (list(const _Base&)): Replace parameter with a struct that wraps a const _Base&. * include/debug/map.h (map(const _Base&)): Likewise. * include/debug/multimap.h (multimap(const _Base&)): Likewise. * include/debug/multiset.h (multiset(const _Base&)): Likewise. * include/debug/set.h (set(const _Base&)): Likewise. * include/debug/unordered_map (unordered_map(const _Base&)) (unordered_multimap(const _Base&)): Likewise. * include/debug/unordered_set (unordered_set(const _Base&)) (unordered_multiset(const _Base&)): Likewise. * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adjust dg-error line number. * include/debug/vector (vector(const _Base&)): Likewise. * testsuite/23_containers/deque/debug/90102.cc: New test. * testsuite/23_containers/forward_list/debug/90102.cc: New test. * testsuite/23_containers/list/debug/90102.cc: New test. * testsuite/23_containers/map/debug/90102.cc: New test. * testsuite/23_containers/multimap/debug/90102.cc: New test. * testsuite/23_containers/multiset/debug/90102.cc: New test. * testsuite/23_containers/set/debug/90102.cc: New test. * testsuite/23_containers/unordered_map/debug/90102.cc: New test. * testsuite/23_containers/unordered_multimap/debug/90102.cc: New test. * testsuite/23_containers/unordered_multiset/debug/90102.cc: New test. * testsuite/23_containers/unordered_set/debug/90102.cc: New test. * testsuite/23_containers/vector/debug/90102.cc: New test. |
||
Jonathan Wakely
|
0fe9eaaa08 |
libstdc++: Improve tests for __cpp_lib_erase_if macro
* testsuite/21_strings/basic_string/erasure.cc: Check for updated value of __cpp_lib_erase_if. * testsuite/23_containers/deque/erasure.cc: Likewise. * testsuite/23_containers/forward_list/erasure.cc: Likewise. * testsuite/23_containers/list/erasure.cc: Likewise. * testsuite/23_containers/map/erasure.cc: Likewise. * testsuite/23_containers/set/erasure.cc: Likewise. * testsuite/23_containers/unordered_map/erasure.cc: Likewise. * testsuite/23_containers/unordered_set/erasure.cc: Likewise. * testsuite/23_containers/vector/erasure.cc: Likewise. |
||
Jonathan Wakely
|
93843da697 |
libstdc++: Add comparison operators to associative containers
The last C++20 changes from P1614R2, "The Mothership has Landed" * include/bits/stl_map.h (map): Define operator<=> and remove operator< for C++20. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_tree.h (_Rb_tree): Likewise. (_Rb_tree_iterator, _Rb_tree_const_iterator): Remove redundant operator!= for C++20. * include/debug/map.h (__gnu_debug::map): Define operator<=> for C++20. * include/debug/multimap.h (__gnu_debug::multimap): Likewise. * include/debug/multiset.h (__gnu_debug::multiset): Likewise. * include/debug/set.h (__gnu_debug::set): Likewise. * testsuite/23_containers/map/operators/cmp_c++20.cc: New test. * testsuite/23_containers/multimap/operators/cmp_c++20.cc: New test. * testsuite/23_containers/multiset/operators/cmp_c++20.cc: New test. * testsuite/23_containers/set/operators/cmp_c++20.cc: New test. |
||
Ville Voutilainen
|
e06cde870e |
Library-side tests for parenthesized aggregate init
PR c++/92878 PR c++/92947 * testsuite/20_util/allocator_traits/members/92878_92947.cc: New. * testsuite/20_util/any/assign/92878_92947.cc: Likewise. * testsuite/20_util/any/cons/92878_92947.cc: Likewise. * testsuite/20_util/is_constructible/92878_92947.cc: Likewise. * testsuite/20_util/optional/assignment/92878_92947.cc: Likewise. * testsuite/20_util/optional/cons/92878_92947.cc: Likewise. * testsuite/20_util/pair/cons/92878_92947.cc: Likewise. * testsuite/20_util/shared_ptr/creation/92878_92947.cc: Likewise. * testsuite/20_util/specialized_algorithms/construct_at/92878_92947.cc: Likewise. * testsuite/20_util/unique_ptr/creation/92878_92947.cc: Likewise. * testsuite/20_util/uses_allocator/92878_92947.cc: Likewise. * testsuite/20_util/variant/92878_92947.cc: Likewise. * testsuite/23_containers/deque/modifiers/emplace/92878_92947.cc: Likewise. * testsuite/23_containers/forward_list/modifiers/92878_92947.cc: Likewise. * testsuite/23_containers/list/modifiers/emplace/92878_92947.cc: Likewise. * testsuite/23_containers/map/modifiers/emplace/92878_92947.cc: Likewise. * testsuite/23_containers/multimap/modifiers/emplace/92878_92947.cc: Likewise. * testsuite/23_containers/multiset/modifiers/emplace/92878_92947.cc: Likewise. * testsuite/23_containers/priority_queue/92878_92947.cc: Likewise. * testsuite/23_containers/queue/92878_92947.cc: Likewise. * testsuite/23_containers/set/modifiers/emplace/92878_92947.cc: Likewise. * testsuite/23_containers/stack/92878_92947.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/92878_92947.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/92878_92947.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/92878_92947.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/92878_92947.cc: Likewise. * testsuite/23_containers/vector/modifiers/emplace/92878_92947.cc: Likewise. |
||
Jonathan Wakely
|
55b00d14f4 |
libstdc++: Update __cpp_lib_erase_if macro (P1115R3)
Now that this feature has been approved for C++20 we can define the macro to the official value. * include/bits/erase_if.h (__cpp_lib_erase_if): Define to 202002L. * include/std/deque: Likewise. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/string: Likewise. * include/std/vector: Likewise. * include/std/version: Likewise. * testsuite/23_containers/deque/erasure.cc: Test for new value. * testsuite/23_containers/forward_list/erasure.cc: Likewise. * testsuite/23_containers/list/erasure.cc: Likewise. * testsuite/23_containers/map/erasure.cc: Likewise. * testsuite/23_containers/set/erasure.cc: Likewise. * testsuite/23_containers/unordered_map/erasure.cc: Likewise. * testsuite/23_containers/unordered_set/erasure.cc: Likewise. * testsuite/23_containers/vector/erasure.cc: Likewise. |
||
François Dumont
|
6af8819be1 |
PR libstdc++/92124 fix incorrect container move assignment
* include/bits/stl_tree.h (_Rb_tree<>::_M_move_assign(_Rb_tree&, false_type)): Replace std::move_if_noexcept by std::move. * testsuite/23_containers/map/92124.cc: New. * testsuite/23_containers/set/92124.cc: New. From-SVN: r279967 |
||
Jakub Jelinek
|
8d9254fc8a |
Update copyright years.
From-SVN: r279813 |
||
Jonathan Wakely
|
2cae56bd61 |
Remove redundant std::allocator members for C++20
C++20 removes a number of std::allocator members that have correct defaults provided by std::allocator_traits, so aren't needed. Several extensions including __gnu_cxx::hash_map and tr1 containers are no longer usable with std::allocator in C++20 mode. They need to be updated to use __gnu_cxx::__alloc_traits in a follow-up patch. * include/bits/alloc_traits.h (allocator_traits<allocator<T>>::allocate): Ignore hint for C++20. (allocator_traits<allocator<T>>::construct): Perform placement new directly for C++20, instead of calling allocator<T>::construct. (allocator_traits<allocator<T>>::destroy): Call destructor directly for C++20, instead of calling allocator<T>::destroy. (allocator_traits<allocator<T>>::max_size): Return value directly for C++20, instead of calling std::allocator<T>::max_size(). (__do_alloc_on_copy, __do_alloc_on_move, __do_alloc_on_swap): Do not define for C++17 and up. (__alloc_on_copy, __alloc_on_move, __alloc_on_swap): Use if-constexpr for C++17 and up, instead of tag dispatching. * include/bits/allocator.h (allocator<void>): Remove for C++20. (allocator::pointer, allocator::const_pointer, allocator::reference) (allocator::const_reference, allocator::rebind): Remove for C++20. * include/bits/basic_string.h (basic_string): Use __alloc_traits to rebind allocator. * include/bits/memoryfwd.h (allocator<void>): Remove for C++20. * include/ext/debug_allocator.h: Use __alloc_traits for rebinding. * include/ext/malloc_allocator.h (malloc_allocator::~malloc_allocator) (malloc_allocator::pointer, malloc_allocator::const_pointer) (malloc_allocator::reference, malloc_allocator::const_reference) (malloc_allocator::rebind, malloc_allocator::max_size) (malloc_allocator::construct, malloc_allocator::destroy): Do not define for C++20. (malloc_allocator::_M_max_size): Define new function. * include/ext/new_allocator.h (new_allocator::~new_allocator) (new_allocator::pointer, new_allocator::const_pointer) (new_allocator::reference, new_allocator::const_reference) (new_allocator::rebind, new_allocator::max_size) (new_allocator::construct, new_allocator::destroy): Do not define for C++20. (new_allocator::_M_max_size): Define new function. * include/ext/rc_string_base.h (__rc_string_base::_Rep): Use __alloc_traits to rebind allocator. * include/ext/rope (_Rope_rep_base, _Rope_base): Likewise. (rope::rope(CharT, const allocator_type&)): Use __alloc_traits to construct character. * include/ext/slist (_Slist_base): Use __alloc_traits to rebind allocator. * include/ext/sso_string_base.h (__sso_string_base::_M_max_size): Use __alloc_traits. * include/ext/throw_allocator.h (throw_allocator): Do not use optional members of std::allocator, use __alloc_traits members instead. * include/ext/vstring.h (__versa_string): Use __alloc_traits. * include/ext/vstring_util.h (__vstring_utility): Likewise. * include/std/memory: Include <bits/alloc_traits.h>. * testsuite/20_util/allocator/8230.cc: Use __gnu_test::max_size. * testsuite/20_util/allocator/rebind_c++20.cc: New test. * testsuite/20_util/allocator/requirements/typedefs.cc: Do not check for pointer, const_pointer, reference, const_reference or rebind in C++20. * testsuite/20_util/allocator/requirements/typedefs_c++20.cc: New test. * testsuite/23_containers/deque/capacity/29134.cc: Use __gnu_test::max_size. * testsuite/23_containers/forward_list/capacity/1.cc: Likewise. * testsuite/23_containers/list/capacity/29134.cc: Likewise. * testsuite/23_containers/map/capacity/29134.cc: Likewise. * testsuite/23_containers/multimap/capacity/29134.cc: Likewise. * testsuite/23_containers/multiset/capacity/29134.cc: Likewise. * testsuite/23_containers/set/capacity/29134.cc: Likewise. * testsuite/23_containers/vector/capacity/29134.cc: Likewise. * testsuite/ext/malloc_allocator/variadic_construct.cc: Do not run test for C++20. * testsuite/ext/new_allocator/variadic_construct.cc: Likewise. * testsuite/ext/vstring/capacity/29134.cc: Use __gnu_test::max_size. * testsuite/util/replacement_memory_operators.h: Do not assume Alloc::pointer exists. * testsuite/util/testsuite_allocator.h (__gnu_test::max_size): Define helper to call max_size for any allocator. From-SVN: r277300 |
||
Jonathan Wakely
|
61e619b4fd |
Disable tests that aren't valid in parallel mode
Tests that depend on debug mode can't be tested in parallel mode. * testsuite/17_intro/using_namespace_std_tr1_neg.cc: Skip test for parallel mode. * testsuite/20_util/hash/84998.cc: Likewise. * testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/list/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/map/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/multimap/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/multiset/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/set/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: Likewise. * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Likewise. * testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: Likewise. * testsuite/25_algorithms/binary_search/partitioned.cc: Likewise. * testsuite/25_algorithms/copy/86658.cc: Likewise. * testsuite/25_algorithms/equal_range/partitioned.cc: Likewise. * testsuite/25_algorithms/lexicographical_compare/71545.cc: Likewise. * testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise. * testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise. From-SVN: r276430 |
||
Jonathan Wakely
|
a2dbc0bf2a |
Fix tests that fail in C++2a mode
The GNU extension that allows using the wrong allocator type with a container is disabled for C++2a mode, because the standard now requires a diagnostic. Fix the tests that fail when -std=gnu++2a is used. Also remove some reundant tests that are duplicates of another test except for a target specifier of c++11. Those tests previously set -std=gnu++11 explicitly but that was replaced globally with a target specifier. These tests existed to verify that explicit instantiation worked for both C++98 and C++11 modes, but now do nothing because both copies of the test use -std=gnu++14 by default. Instead of duplicating the test we should be regularly running the whole testsuite with different -std options. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 2.cc: Use target selector instead of preprocessor condition. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/list/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/list/requirements/explicit_instantiation/ 2.cc: Use target selector instead of preprocessor condition. * testsuite/23_containers/list/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/map/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/map/requirements/explicit_instantiation/ 2.cc: Adjust comment. * testsuite/23_containers/map/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/map/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/set/requirements/explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/set/requirements/explicit_instantiation/ 1_c++0x.cc: Remove redundant test. * testsuite/23_containers/set/requirements/explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/3.cc: Do not run test for C++2a. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/5.cc: Do not test allocator rebinding extension for C++2a. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 2.cc: Remove redundant test. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 3.cc: Do not run test for C++2a. * testsuite/23_containers/vector/requirements/explicit_instantiation/ 3.cc: Likewise. From-SVN: r272001 |
||
Jonathan Wakely
|
ebaf365963 |
Enforce allocator::value_type consistency for containers in C++2a
In previous standards it is undefined for a container and its allocator to have a different value_type. Libstdc++ has traditionally allowed it as an extension, automatically rebinding the allocator to the container's value_type. Since GCC 8.1 that extension has been disabled for C++11 and later when __STRICT_ANSI__ is defined (i.e. for -std=c++11, -std=c++14, -std=c++17 and -std=c++2a). Since the acceptance of P1463R1 into the C++2a draft an incorrect allocator::value_type now requires a diagnostic. This patch implements that by enabling the static_assert for -std=gnu++2a as well. * doc/xml/manual/status_cxx2020.xml: Document P1463R1 status. * include/bits/forward_list.h [__cplusplus > 201703]: Enable allocator::value_type assertion for C++2a. * include/bits/hashtable.h: Likewise. * include/bits/stl_deque.h: Likewise. * include/bits/stl_list.h: Likewise. * include/bits/stl_map.h: Likewise. * include/bits/stl_multimap.h: Likewise. * include/bits/stl_multiset.h: Likewise. * include/bits/stl_set.h: Likewise. * include/bits/stl_vector.h: Likewise. * testsuite/23_containers/deque/48101-3_neg.cc: New test. * testsuite/23_containers/forward_list/48101-3_neg.cc: New test. * testsuite/23_containers/list/48101-3_neg.cc: New test. * testsuite/23_containers/map/48101-3_neg.cc: New test. * testsuite/23_containers/multimap/48101-3_neg.cc: New test. * testsuite/23_containers/multiset/48101-3_neg.cc: New test. * testsuite/23_containers/set/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_map/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_multimap/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_multiset/48101-3_neg.cc: New test. * testsuite/23_containers/unordered_set/48101-3_neg.cc: New test. * testsuite/23_containers/vector/48101-3_neg.cc: New test. From-SVN: r271866 |
||
Jonathan Wakely
|
e625ccc21a |
PR libstdc++/85965 move is_invocable assertions again
This is another attempt to reduce how often the assertions are evaluated, so that code which doesn't try to use the function objects doesn't need them to be invocable. For _Rb_tree we access the _M_key_compare object directly, so can't put the assertions in an accessor function for it. However, every invocation of _M_key_compare is accompanied by a use of _S_key, so the assertions can be put in there. For _Hashtable there are member functions that are consistently used to obtain a hash code or test for equality, so the assertions can go in those members. PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable::~_Hashtable()): Remove static assertions from the destructor. * include/bits/hashtable_policy.h (_Hash_code_base::_M_hash_code): Move static_assert for hash function to here. (_Hash_table_base::_M_equals): Move static_assert for equality predicate to here. * include/bits/stl_tree.h (_Rb_tree::_S_value(_Const_Link_type)): Remove. (_Rb_tree::_S_key(_Const_Link_type)): Move assertions here. Access the value directly instead of calling _S_value. (_Rb_tree::_S_value(_Const_Base_ptr)): Remove. (_Rb_tree::_S_key(_Const_Base_ptr)): Do downcast and forward to _S_key(_Const_Link_type). * testsuite/23_containers/set/85965.cc: Check construction, destruction, assignment and size() do not trigger the assertions. * testsuite/23_containers/unordered_set/85965.cc: Likewise. * testsuite/23_containers/map/48101_neg.cc: Call find and adjust expected errors. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. From-SVN: r271323 |
||
François Dumont
|
935469daaa |
Move from state of allocators (LWG2593)
2019-05-17 François Dumont <fdumont@gcc.gnu.org> Move from state of allocators (LWG2593) * include/bits/stl_deque.h (_Deque_base(_Deque_base&&, false_type)): Remove. (_Deque_base(_Deque_base&&, true_type)): Remove. (_Deque_base(_Deque_base&&)): Adapt. (_Deque_base::_M_move_impl()): Remove. * testsuite/util/testsuite_allocator.h (propagating_allocator(propagating_allocator&&)): Preserve move from state. * testsuite/23_containers/deque/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/forward_list/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/list/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/map/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/multimap/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/multiset/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/set/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/unordered_map/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/unordered_multimap/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/unordered_multiset/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/unordered_set/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/vector/allocator/move_assign.cc (test02): Adapt. * testsuite/23_containers/vector/bool/allocator/move_assign.cc (test02): Adapt. * testsuite/21_strings/basic_string/allocator/char/move_assign.cc (test02): Adapt. * testsuite/21_strings/basic_string/allocator/wchar_t/move_assign.cc (test02): Adapt. From-SVN: r271309 |
||
Jonathan Wakely
|
544be2beb1 |
Remove Profile Mode, deprecated since GCC 7.1
The Profile Mode extension is not used by anybody, nor maintained by anybody. The containers do not support the full API specified in recent standards, and so enabling Profile Mode is not source compatible with much modern C++ code. The heuristics that would check the profile information and make useful suggestions never materialized, so it isn't useful. It should be removed. Remove Profile Mode, deprecated since 7.1.0 * doc/Makefile.am: Remove XML file for profile mode docs. * doc/Makefile.in: Regenerate. * doc/xml/authors.xml: Remove authors of profile mode docs. * doc/xml/manual/appendix_contributing.xml: Remove mention of profile mode. * doc/xml/manual/debug.xml: Likewise. * doc/xml/manual/evolution.xml: Document removal of profile mode. * doc/xml/manual/profile_mode.xml: Remove profile mode docs. * doc/xml/manual/spine.xml: Remove profile mode author credit. * doc/xml/manual/test.xml: Remove docs for dg-require-profile-mode directive. * doc/xml/manual/using.xml: Remove docs for profile mode headers and macro. * doc/html/*: Regenerate. * include/Makefile.am: Remove profile mode headers. * include/Makefile.in: Regenerate. * include/bits/c++config (std::__profile): Remove namespace. [_GLIBCXX_PROFILE]: Remove checks for macro. * include/profile/array: Remove. * include/profile/base.h: Remove. * include/profile/bitset: Remove. * include/profile/deque: Remove. * include/profile/forward_list: Remove. * include/profile/impl/profiler.h: Remove. * include/profile/impl/profiler_algos.h: Remove. * include/profile/impl/profiler_container_size.h: Remove. * include/profile/impl/profiler_hash_func.h: Remove. * include/profile/impl/profiler_hashtable_size.h: Remove. * include/profile/impl/profiler_list_to_slist.h: Remove. * include/profile/impl/profiler_list_to_vector.h: Remove. * include/profile/impl/profiler_map_to_unordered_map.h: Remove. * include/profile/impl/profiler_node.h: Remove. * include/profile/impl/profiler_state.h: Remove. * include/profile/impl/profiler_trace.h: Remove. * include/profile/impl/profiler_vector_size.h: Remove. * include/profile/impl/profiler_vector_to_list.h: Remove. * include/profile/iterator_tracker.h: Remove. * include/profile/list: Remove. * include/profile/map: Remove. * include/profile/map.h: Remove. * include/profile/multimap.h: Remove. * include/profile/multiset.h: Remove. * include/profile/ordered_base.h: Remove. * include/profile/set: Remove. * include/profile/set.h: Remove. * include/profile/unordered_base.h: Remove. * include/profile/unordered_map: Remove. * include/profile/unordered_set: Remove. * include/profile/vector: Remove. * scripts/run_doxygen: Do not process profile mode headers. * testsuite/23_containers/array/element_access/60497.cc: Don't use profile mode type. * testsuite/23_containers/array/specialized_algorithms/swap_cxx17.cc: Remove dg-skip-if for profile mode. * testsuite/23_containers/forward_list/capacity/1.cc: Remove preprocessor check for profile mode. * testsuite/23_containers/list/capacity/29134.cc: Likewise. * testsuite/23_containers/map/modifiers/extract.cc: Remove dg-skip-if for profile mode. * testsuite/23_containers/map/modifiers/insert_or_assign/1.cc: Likewise. * testsuite/23_containers/map/modifiers/try_emplace/1.cc: Likewise. * testsuite/23_containers/multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/set/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_map/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multimap/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_multiset/modifiers/extract.cc: Likewise. * testsuite/23_containers/unordered_set/modifiers/extract.cc: Likewise. * testsuite/23_containers/vector/bool/capacity/29134.cc: Remove preprocessor check for profile mode. * testsuite/23_containers/vector/bool/modifiers/insert/31370.cc: Likewise. * testsuite/23_containers/vector/modifiers/insert_vs_emplace.cc: Remove dg-skip-if for profile mode. * testsuite/25_algorithms/binary_search/partitioned.cc: Likewise. * testsuite/25_algorithms/equal_range/partitioned.cc: Likewise. * testsuite/25_algorithms/lexicographical_compare/71545.cc: Likewise. * testsuite/25_algorithms/lower_bound/partitioned.cc: Likewise. * testsuite/25_algorithms/upper_bound/partitioned.cc: Likewise. * testsuite/Makefile.am: Remove profile_flags variable and * testsuite/Makefile.am: Remove profile_flags variable and check-profile target. * testsuite/Makefile.in: Regenerate. * testsuite/ext/profile/all.cc: Remove. * testsuite/ext/profile/mutex_extensions_neg.cc: Remove. * testsuite/ext/profile/profiler_algos.cc: Remove. * testsuite/ext/profile/replace_new.cc: Remove. * testsuite/ext/throw_allocator/deallocate_global.cc: Remove preprocessor check for profile mode. * testsuite/ext/throw_allocator/deallocate_local.cc: Likewise. * testsuite/lib/libstdc++.exp (check_v3_target_profile_mode): Remove. (check_v3_target_normal_mode): Do not check for profile mode macro. * testsuite/libstdc++-prettyprinters/80276.cc: Remove dg-skip-if for profile mode. * testsuite/libstdc++-prettyprinters/compat.cc: Likewise. * testsuite/libstdc++-prettyprinters/cxx11.cc: Likewise. * testsuite/libstdc++-prettyprinters/cxx17.cc: Likewise. * testsuite/libstdc++-prettyprinters/debug.cc: Likewise. * testsuite/libstdc++-prettyprinters/debug_cxx11.cc: Likewise. * testsuite/libstdc++-prettyprinters/libfundts.cc: Likewise. * testsuite/libstdc++-prettyprinters/simple.cc: Likewise. * testsuite/libstdc++-prettyprinters/simple11.cc: Likewise. * testsuite/libstdc++-prettyprinters/whatis.cc: Likewise. * testsuite/libstdc++-prettyprinters/whatis2.cc: Likewise. From-SVN: r271120 |
||
Jonathan Wakely
|
7ac205673c |
PR libstdc++/85965 delay static assertions until types are complete
The static assertions added for PR libstdc++/48101 were at class scope and so were evaluated too eagerly, when it might not be possible to determine whether the function objects are invocable with the key types. The problematic cases are where the key type is not known to be convertible to the argument type(s) of the function object until later, after a type has been completed. Specifically, if the key type is a pointer to a derived class and the function object's argument type is a pointer to a base class, then the derived-to-base conversion is only valid once the derived type is complete. By moving the static assertions to the destructor they will only be evaluated when the destructor is instantiated, at which point whether the key type can be passed to the function object should be knowable. The ideal place to do the checks would be only when the function objects are actually invoked, but that would mean adding the checks in numerous places, so the destructor is used instead. The tests need to be adjusted because the "required from here" line is now the location of the destructor, not the point of instantiation in the test file. For the map and multimap tests which check two specializations, the dg-error matching the assertion text matches both cases. Also check the diagnostic output for the template arguments, to ensure both specializations trigger the assertion. PR libstdc++/85965 * include/bits/hashtable.h (_Hashtable): Move static assertions to destructor so they are not evaluated until the _Key type is complete. * include/bits/stl_tree.h (_Rb_tree): Likewise. * testsuite/23_containers/set/85965.cc: New test. * testsuite/23_containers/unordered_set/85965.cc: New test. * testsuite/23_containers/map/48101_neg.cc: Replace "here" errors with regexp matching the corresponding _Rb_tree specialization. * testsuite/23_containers/multimap/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Remove "here" error. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_map/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multimap/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. From-SVN: r269949 |
||
Jonathan Wakely
|
08abbddaaa |
PR libstdc++/89477 constrain deduction guides for maps and sets
The Compare, Hash, and Pred template parameters should be constrained in the C++17 deduction guides for associative and unordered containers. The deduction guides for stack, queue and priority_queue are already constrained, but this patch makes them use the _RequireNotAllocator helper instead of reproducing the logic each time. PR libstdc++/89477 * include/bits/alloc_traits.h (_RequireNotAllocator): New helper for container deduction guides. * include/bits/hashtable.h (_RequireNotAllocatorOrIntegral): Likewise. * include/bits/stl_map.h (map): Use _RequireNotAllocator to constrain parameters in deduction guides. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_queue.h (queue, priority_queue): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_stack.h (stack): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): use _RequireNotAllocator and _RequireNotAllocatorOrIntegral to constrain parameters in deduction guides. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/map/cons/deduction.cc: Test additional deduction cases. * testsuite/23_containers/multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/set/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_map/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multimap/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_multiset/cons/deduction.cc: Likewise. * testsuite/23_containers/unordered_set/cons/deduction.cc: Likewise. From-SVN: r269234 |
||
Jonathan Wakely
|
45a8d80fec |
Define __cpp_lib_erase_if feature test macro
The C++2a draft specifies the value 201811L for this, but as an extension we return the number of elements erased. This is expected to be standardised, so the macro has the value 201900L until a proper value is specified in the draft. * include/bits/erase_if.h: Define __cpp_lib_erase_if. * include/std/deque: Likewise. * include/std/forward_list: Likewise. * include/std/list: Likewise. * include/std/string: Likewise. * include/std/vector: Likewise. * include/std/version: Likewise. * testsuite/21_strings/basic_string/erasure.cc: Test macro. * testsuite/23_containers/deque/erasure.cc: Likewise. * testsuite/23_containers/forward_list/erasure.cc: Likewise. * testsuite/23_containers/list/erasure.cc: Likewise. * testsuite/23_containers/map/erasure.cc: Likewise. * testsuite/23_containers/set/erasure.cc: Likewise. * testsuite/23_containers/unordered_map/erasure.cc: Likewise. * testsuite/23_containers/unordered_set/erasure.cc: Likewise. * testsuite/23_containers/vector/erasure.cc: Likewise. From-SVN: r267810 |
||
Jakub Jelinek
|
a554497024 |
Update copyright years.
From-SVN: r267494 |
||
Edward Smith-Rowland
|
0b44b4b807 |
Pre-emptively support P0646R1 for std container erasure.
2018-11-30 Edward Smith-Rowland <3dw4rd@verizon.net> Pre-emptively support P0646R1 for std container erasure. * include/bits/erase_if.h: Accumulate and return number of erased nodes. * include/std/forward_list (): Return number of erased items. * include/std/list (): Ditto. * include/std/map (): Ditto. * include/std/set (): Ditto. * include/std/string (): Ditto. * include/std/unordered_map (): Ditto. * include/std/unordered_set (): Ditto. * include/std/vector (): Ditto. * testsuite/21_strings/basic_string/erasure.cc: Test number of erasures. * testsuite/23_containers/deque/erasure.cc: Ditto. * testsuite/23_containers/forward_list/erasure.cc: Ditto. * testsuite/23_containers/list/erasure.cc: Ditto. * testsuite/23_containers/map/erasure.cc: Ditto. * testsuite/23_containers/set/erasure.cc: Ditto. * testsuite/23_containers/unordered_map/erasure.cc: Ditto. * testsuite/23_containers/unordered_set/erasure.cc: Ditto. * testsuite/23_containers/vector/erasure.cc: Ditto. From-SVN: r266672 |
||
Edward Smith-Rowland
|
a62b871d65 |
Fix erasure goofs.
2018-11-29 Edward Smith-Rowland <3dw4rd@verizon.net> Fix erasure goofs. * include/experimental/deque: Make inline. * include/std/deque: Include bits/stl_algo.h. (erase, erase_if): Make inline. * include/std/string: Include bits/stl_algo.h. * include/std/unordered_set: Add erase, erase_if! * include/std/vector: Include bits/stl_algo.h. * testsuite/21_strings/basic_string/erasure.cc: Add { dg-options "-std=gnu++2a" }. * testsuite/23_containers/deque/erasure.cc: Ditto. * testsuite/23_containers/forward_list/erasure.cc: Ditto. * testsuite/23_containers/list/erasure.cc: Ditto. * testsuite/23_containers/map/erasure.cc: Ditto. * testsuite/23_containers/set/erasure.cc: Ditto. * testsuite/23_containers/unordered_map/erasure.cc: Ditto. * testsuite/23_containers/unordered_set/erasure.cc: Ditto. * testsuite/23_containers/vector/erasure.cc: Ditto. From-SVN: r266616 |
||
Edward Smith-Rowland
|
188588e443 |
Implement uniform container erasure for C++20.
2018-11-28 Edward Smith-Rowland <3dw4rd@verizon.net> Implement uniform container erasure for C++20. * include/Makefile.am: Move erase_if.h. * include/Makefile.in: Move erase_if.h. * include/experimental/bits/erase_if.h: Move ... * include/bits/erase_if.h: ... here. * include/experimental/map: Move erase_if.h. * include/experimental/set: Move erase_if.h. * include/experimental/unordered_map: Move erase_if.h. * include/experimental/unordered_set: Move erase_if.h. * include/std/deque (erase_if, erase): New functions. * include/std/forward_list: Ditto. * include/std/list: Ditto. * include/std/map: Ditto. * include/std/set: Ditto. * include/std/string: Ditto. * include/std/unordered_map: Ditto. * include/std/unordered_set: Ditto. * include/std/vector: Ditto. * testsuite/21_strings/basic_string/erasure.cc: New test. * testsuite/23_containers/deque/erasure.cc: New test. * testsuite/23_containers/forward_list/erasure.cc: New test. * testsuite/23_containers/list/erasure.cc: New test. * testsuite/23_containers/map/erasure.cc: New test. * testsuite/23_containers/set/erasure.cc: New test. * testsuite/23_containers/unordered_map/erasure.cc: New test. * testsuite/23_containers/unordered_set/erasure.cc: New test. * testsuite/23_containers/vector/erasure.cc: New test. From-SVN: r266567 |
||
Jonathan Wakely
|
f324588755 |
Skip tests for GNU extensions when testing with strict mode
Tests for the implicit allocator rebinding extension will fail if the extension is disabled, so skip them. * testsuite/23_containers/array/requirements/explicit_instantiation/ 3.cc: Skip test when compiled with a -std=c++NN strict mode. * testsuite/23_containers/deque/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/list/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/3.cc: Likewise. * testsuite/23_containers/vector/ext_pointer/explicit_instantiation/ 3.cc: Likewise. * testsuite/23_containers/vector/requirements/explicit_instantiation/ 3.cc: Likewise. From-SVN: r265334 |
||
Jonathan Wakely
|
92bab15297 |
Fix testsuite failures due to extra errors in strict dialects
When __STRICT_ANSI__ is defined the incorrect allocators used in these tests also trigger and additional static assertion. Prune those extra errors so that the tests don't fail when built with strict dialects. * testsuite/23_containers/deque/48101_neg.cc: Prune additional errors printed when __STRICT_ANSI__ is defined. * testsuite/23_containers/forward_list/48101_neg.cc: Likewise. * testsuite/23_containers/list/48101_neg.cc: Likewise. * testsuite/23_containers/multiset/48101_neg.cc: Likewise. * testsuite/23_containers/set/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_multiset/48101_neg.cc: Likewise. * testsuite/23_containers/unordered_set/48101_neg.cc: Likewise. * testsuite/23_containers/vector/48101_neg.cc: Likewise. From-SVN: r265333 |
||
Jonathan Wakely
|
f8f3939037 |
Conditionally disable tests of non-standard extensions
These tests include uses of the extension to allow allocators with the wrong value_type in containers. Skip those parts of the tests when __STRICT_ANIS__ is defined. * testsuite/23_containers/forward_list/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Don't test non-standard extension. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/map/requirements/explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_map/requirements/debug_container.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_map/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_multimap/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_multiset/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. * testsuite/23_containers/unordered_set/requirements/ explicit_instantiation/5.cc [__STRICT_ANSI__]: Likewise. From-SVN: r265332 |
||
Jonathan Wakely
|
88412b71ee |
Remove duplicate tests
These tests originally existed to check the containers in C++11 mode, when the default was C++98 mode. Now that the default is C++14 (and we run most tests for all modes) it serves no purpose to have two copies of the tests when neither is explicitly using -std=gnu++98 anyway. * testsuite/23_containers/list/requirements/explicit_instantiation/ 5_c++0x.cc: Remove redundant test that is functionally identical to the 5.cc test. * testsuite/23_containers/map/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/multimap/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/multiset/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. * testsuite/23_containers/set/requirements/explicit_instantiation/ 5_c++0x.cc: Likewise. From-SVN: r265329 |
||
Jonathan Wakely
|
83a840a91f |
PR libstdc++/87194 fix range insertion into maps and sets
Since C++11 range insertion and construction of maps and sets from a pair of iterators only requires that the iterator's value_type is convertible to the container's value_type (previously it had to be the same). This fixes the implementation to meet that relaxed requirement, by defining a pair of overloads that either insert or emplace, depending on the iterator's value_type. Instead of adding yet another overload of _M_insert_unique and _M_insert_equal, the overloads taking iterators are renamed to _M_insert_range_unique and _M_insert_range_equal. PR libstdc++/87194 * include/bits/stl_map.h (map::map(initializer_list<value_type>, const Compare&, const Alloc&)) (map::map(initializer_list<value_type>, const Alloc&)) (map::map(InputIterator, InputIterator, const Alloc&)) (map::map(InputIterator, InputIterator)) (map::map(InputIterator, InputIterator, const Compare&, const Alloc&)) (map::insert(InputIterator, InputIterator)): Call _M_insert_range_unique instead of _M_insert_unique. * include/bits/stl_multimap.h (multimap::multimap(initializer_list<value_type>, const C&, const A&)) (multimap::multimap(initializer_list<value_type>, const A&)) (multimap::multimap(InputIterator, InputIterator, const A&)) (multimap::multimap(InputIterator, InputIterator)) (multimap::multimap(InputIterator, InputIterator, const C&, const A&)) (multimap::insert(InputIterator, InputIterator)): Call _M_insert_range_equal instead of _M_insert_equal. * include/bits/stl_multiset.h (multiset::multiset(InputIterator, InputIterator)) (multiset::multiset(InputIterator, InputIterator, const C&, const A&)) (multiset::multiset(initializer_list<value_type>, const C&, const A&)) (multiset::multiset(initializer_list<value_type>, const A&)) (multiset::multiset(InputIterator, InputIterator, const A&)) (multiset::insert(InputIterator, InputIterator)): Call _M_insert_range_equal instead of _M_insert_equal. * include/bits/stl_set.h (set::set(InputIterator, InputIterator)) (set::set(InputIterator, InputIterator, const Compare&, const Alloc&)) (set::set(initializer_list<value_type>, const Compare&, const Alloc&)) (set::set(initializer_list<value_type>, const Alloc&)) (set::set(InputIterator, InputIterator, const Alloc&)) (set::insert(InputIterator, InputIterator)): Call _M_insert_range_unique instead of _M_insert_unique. * include/bits/stl_tree.h [__cplusplus >= 201103L] (_Rb_tree::__same_value_type): New alias template for SFINAE constraints. [__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_unique): Pair of constrained overloads that either insert or emplace, depending on iterator's value_type. [__cplusplus >= 201103L] (_Rb_tree::_M_insert_range_equal): Likewise. [__cplusplus < 201103L] (_Rb_tree::_M_insert_range_unique) (_Rb_tree::_M_insert_range_equal): New functions replacing range versions of _M_insert_unique and _M_insert_equal. (_Rb_tree::_M_insert_unique(_InputIterator, _InputIterator)) (_Rb_tree::_M_insert_equal(_InputIterator, _InputIterator)): Remove. * testsuite/23_containers/map/modifiers/insert/87194.cc: New test. * testsuite/23_containers/multimap/modifiers/insert/87194.cc: New test. * testsuite/23_containers/multiset/modifiers/insert/87194.cc: New test. * testsuite/23_containers/set/modifiers/insert/87194.cc: New test. From-SVN: r264060 |
||
Jonathan Wakely
|
9ca2ac699a |
Forward declare debug containers so std::pmr aliases work
Prior to this change, including a <debug/xxx> header when _GLIBCXX_DEBUG is also defined would fail to compile in C++17 or later. The <debug/xxx> header would include the standard <xxx> header which defined std::pmr::xxx as an alias for std::xxx. But in Debug Mode std::xxx refers to std::__debug::xxx which has not been defined yet (because it is in <debug/xxx> after the inclusion of <xxx>). This adds declarations of the debug containers before including the non-Debug Mode <xxx> header, so that the std::pmr::xxx aliases work. * include/debug/deque (std::__debug::deque): Declare. * include/debug/forward_list (std::__debug::forward_list): Declare. * include/debug/list (std::__debug::list): Declare. * include/debug/map (std::__debug::map): Declare. * include/debug/set (std::__debug::set): Declare. * include/debug/unordered_map (std::__debug::unordered_map): Declare. * include/debug/unordered_set (std::__debug::unordered_set): Declare. * include/debug/vector (std::__debug::vector): Declare. * testsuite/23_containers/deque/types/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/forward_list/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/list/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/map/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/multimap/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/multiset/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/set/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/unordered_map/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/unordered_multimap/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/unordered_multiset/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/unordered_set/pmr_typedefs_debug.cc: New test. * testsuite/23_containers/vector/cons/destructible_debug_neg.cc: Adjust dg-error lineno. * testsuite/23_containers/vector/types/pmr_typedefs_debug.cc: New test. From-SVN: r263839 |
||
Jonathan Wakely
|
1fc9d0b0e4 |
Define aliases for containers using polymorphic_allocator
These aliases are placed in the top-level header, e.g. <vector> not <bits/stl_vector.h>. This ensures that they refer to whichever of std::vector or __debug::vector or __profile::vector is in use when the header is included. * include/std/deque (std::pmr::deque): Declare alias. * include/std/forward_list (std::pmr::forward_list): Likewise. * include/std/list (std::pmr::list): Likewise. * include/std/map (std::pmr::map, std::pmr::multimap): Likewise. * include/std/regex (std::pmr::match_results, std::pmr::cmatch) (std::pmr::smatch, std::pmr::wcmatch, std::pmr::wsmatch): Likewise. * include/std/set (std::pmr::set, std::pmr::multiset): Likewise. * include/std/string (std::pmr::basic_string, std::pmr::string) (std::pmr::u16string, std::pmr::u32string, std::pmr::wstring): Likewise. * include/std/unordered_map (std::pmr::unordered_map) (std::pmr::unordered_multimap): Likewise. * include/std/unordered_set (std::pmr::unordered_set) (std::pmr::unordered_multiset): Likewise. * include/std/vector (std::pmr::vector): Likewise. * testsuite/21_strings/basic_string/types/pmr_typedefs.cc: New test. * testsuite/23_containers/deque/types/pmr_typedefs.cc: New test. * testsuite/23_containers/forward_list/pmr_typedefs.cc: New test. * testsuite/23_containers/list/pmr_typedefs.cc: New test. * testsuite/23_containers/map/pmr_typedefs.cc: New test. * testsuite/23_containers/multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/set/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_map/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multimap/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_multiset/pmr_typedefs.cc: New test. * testsuite/23_containers/unordered_set/pmr_typedefs.cc: New test. * testsuite/23_containers/vector/pmr_typedefs.cc: New test. * testsuite/28_regex/match_results/pmr_typedefs.cc: New test. From-SVN: r263456 |
||
Jonathan Wakely
|
49ba258864 |
Add missing dg-require-cstdint directives to tests
* testsuite/18_support/aligned_alloc/aligned_alloc.cc: Add dg-require-cstdint directive. * testsuite/20_util/allocator/overaligned.cc: Likewise. * testsuite/20_util/any/cons/aligned.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/allocate.cc: Likewise. * testsuite/20_util/monotonic_buffer_resource/deallocate.cc: Likewise. * testsuite/20_util/shared_ptr/thread/default_weaktoshared.cc: Likewise. * testsuite/20_util/shared_ptr/thread/mutex_weaktoshared.cc: Likewise. * testsuite/23_containers/list/modifiers/insert/25288.cc: Likewise. * testsuite/23_containers/set/allocator/move_assign.cc: Likewise. * testsuite/25_algorithms/make_heap/complexity.cc: Likewise. * testsuite/25_algorithms/pop_heap/complexity.cc: Require cstdint and random_device effective-target. * testsuite/25_algorithms/push_heap/complexity.cc: Likewise. * testsuite/25_algorithms/sample/1.cc: Require cstdint. * testsuite/25_algorithms/sample/2.cc: Likewise. * testsuite/25_algorithms/sort_heap/complexity.cc: Require cstdint and random_device. * testsuite/26_numerics/headers/random/types_std_c++0x.cc: Require cstdint. * testsuite/26_numerics/random/chi_squared_distribution/83833.cc: Likewise. * testsuite/26_numerics/random/discard_block_engine/requirements/ constexpr_data.cc: Likewise. * testsuite/26_numerics/random/discard_block_engine/requirements/ constexpr_functions.cc: Likewise. * testsuite/26_numerics/random/independent_bits_engine/requirements/ constexpr_functions.cc: Likewise. * testsuite/26_numerics/random/linear_congruential_engine/requirements/ constexpr_data.cc: Likewise. * testsuite/26_numerics/random/linear_congruential_engine/requirements/ constexpr_functions.cc: Likewise. * testsuite/26_numerics/random/mersenne_twister_engine/requirements/ constexpr_data.cc: Likewise. * testsuite/26_numerics/random/mersenne_twister_engine/requirements/ constexpr_functions.cc: Likewise. * testsuite/26_numerics/random/pr60037-neg.cc: Likewise. * testsuite/26_numerics/random/seed_seq/cons/65631.cc: Likewise. * testsuite/26_numerics/random/shuffle_order_engine/requirements/ constexpr_data.cc: Add dg-require-cstdint directive. * testsuite/26_numerics/random/shuffle_order_engine/requirements/ constexpr_functions.cc: Likewise. * testsuite/26_numerics/random/subtract_with_carry_engine/requirements/ constexpr_data.cc: Likewise. * testsuite/26_numerics/random/subtract_with_carry_engine/requirements/ constexpr_functions.cc: Likewise. * testsuite/26_numerics/random/uniform_real_distribution/operators/ 64351.cc: Likewise. * testsuite/29_atomics/headers/atomic/types_std_c++0x.cc: Likewise. * testsuite/experimental/algorithm/sample-2.cc: Likewise. * testsuite/experimental/algorithm/sample.cc: Likewise. * testsuite/experimental/algorithm/search.cc: Likewise. * testsuite/experimental/algorithm/shuffle.cc: Likewise. * testsuite/experimental/any/cons/aligned.cc: Likewise. * testsuite/experimental/memory_resource/new_delete_resource.cc: Likewise. * testsuite/experimental/memory_resource/resource_adaptor.cc: Likewise. * testsuite/experimental/random/randint.cc: Likewise. * testsuite/experimental/source_location/1.cc: Likewise. * testsuite/ext/bitmap_allocator/overaligned.cc: Likewise. * testsuite/ext/malloc_allocator/overaligned.cc: Likewise. * testsuite/ext/mt_allocator/overaligned.cc: Likewise. * testsuite/ext/new_allocator/overaligned.cc: Likewise. * testsuite/ext/pb_ds/regression/hash_map_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/hash_set_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/list_update_map_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/list_update_set_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/priority_queue_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/tree_map_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/tree_set_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/trie_map_rand.cc: Likewise. * testsuite/ext/pb_ds/regression/trie_set_rand.cc: Likewise. * testsuite/ext/pool_allocator/overaligned.cc: Likewise. * testsuite/ext/throw_allocator/check_allocate_max_size.cc: Likewise. * testsuite/ext/throw_allocator/check_deallocate_null.cc: Likewise. * testsuite/ext/throw_allocator/check_delete.cc: Likewise. * testsuite/ext/throw_allocator/check_new.cc: Likewise. * testsuite/ext/throw_allocator/deallocate_global.cc: Likewise. * testsuite/ext/throw_allocator/deallocate_local.cc: Likewise. * testsuite/ext/throw_allocator/explicit_instantiation.cc: Likewise. * testsuite/ext/throw_allocator/variadic_construct.cc: Likewise. * testsuite/tr1/8_c_compatibility/cinttypes/functions.cc: Likewise. From-SVN: r263008 |
||
Jonathan Wakely
|
3adea09eea |
P0458R2 Checking for Existence of an Element in Associative Containers
* include/bits/stl_map.h (map::contains): Add for C++2a. * include/bits/stl_multimap.h (multimap::contains): Likewise. * include/bits/stl_multiset.h (multiset::contains): Likewise. * include/bits/stl_set.h (set::contains): Likewise. * include/bits/stl_tree.h (__has_is_transparent_t): Define alias. (_Rb_tree::_M_find_tr, _Rb_tree::_M_count_tr) (_Rb_tree::_M_lower_bound_tr, _Rb_tree::_M_upper_bound_tr) (_Rb_tree::_M_equal_range_tr): Use __has_is_transparent_t. * include/bits/unordered_map.h (unordered_map::contains) (unordered_multimap::contains): Add for C++2a. * include/bits/unordered_set.h (unordered_set::contains) (unordered_multiset::contains): Likewise. * testsuite/23_containers/map/operations/contains.cc: New. * testsuite/23_containers/multimap/operations/contains.cc: New. * testsuite/23_containers/multiset/operations/contains.cc: New. * testsuite/23_containers/set/operations/contains.cc: New. * testsuite/23_containers/unordered_map/operations/contains.cc: New. * testsuite/23_containers/unordered_multimap/operations/contains.cc: New. * testsuite/23_containers/unordered_multiset/operations/contains.cc: New. * testsuite/23_containers/unordered_set/operations/contains.cc: New. From-SVN: r262418 |
||
François Dumont
|
8b0cd47a1c |
2018-05-18 François Dumont <fdumont@gcc.gnu.org>
* include/bits/stl_tree.h (_Rb_tree_impl(_Rb_tree_impl&&, _Node_allocator&&)): New. (_Rb_tree(_Rb_tree&&, _Node_allocator&&, true_type)): New, use latter. (_Rb_tree(_Rb_tree&&, _Node_allocator&&, false_type)): New. (_Rb_tree(_Rb_tree&&, _Node_allocator&&)): Adapt, use latters. * include/debug/map.h (map(map&&, const_allocator_type&)): Add noexcept qualitication. * include/debug/multimap.h (multimap(multimap&&, const_allocator_type&)): Likewise. * include/debug/set.h (set(set&&, const_allocator_type&)): Likewise. * include/debug/multiset.h (multiset(multiset&&, const_allocator_type&)): Likewise. * testsuite/23_containers/map/cons/noexcept_default_construct.cc: Add checks. * testsuite/23_containers/map/cons/noexcept_move_construct.cc: Add checks. * testsuite/23_containers/multimap/cons/noexcept_default_construct.cc: Add checks. * testsuite/23_containers/multimap/cons/noexcept_move_construct.cc: Add checks. * testsuite/23_containers/multiset/cons/noexcept_default_construct.cc: Add checks. * testsuite/23_containers/multiset/cons/noexcept_move_construct.cc: Add checks. * testsuite/23_containers/set/cons/noexcept_default_construct.cc: Add checks. * testsuite/23_containers/set/cons/noexcept_move_construct.cc: Add checks. From-SVN: r260382 |
||
Jonathan Wakely
|
3846b8e4b3 |
PR libstdc++/82966 fix swapping of node handles
PR libstdc++/82966 * include/bits/node_handle.h (_Node_handle_common::_M_swap): Use value instead of type. * testsuite/23_containers/set/modifiers/node_swap.cc: New. From-SVN: r260226 |
||
Jakub Jelinek
|
85ec4feb11 |
Update copyright years.
From-SVN: r256169 |
||
Jonathan Wakely
|
866e4d3853 |
PR libstdc++/48101 improve errors for invalid container specializations
PR libstdc++/48101 * include/bits/allocator.h (allocator<const _Tp>) (allocator<volatile _Tp>, allocator<const volatile _Tp>): Add partial specializations. * include/bits/forward_list.h (forward_list): Add static assertions. * include/bits/hashtable.h (__cache_default): Use __is_nothrow_invocable instead of __is_noexcept_hash. (_Hashtable): Add static assertions. * include/bits/hashtable_policy.h (__is_noexcept_hash): Remove. * include/bits/stl_deque.h (deque): Add static assertions. * include/bits/stl_function.h (_Identity<const _Tp>): Add partial specialization. * include/bits/stl_list.h (list): Add static assertions. * include/bits/stl_map.h (map): Likewise. * include/bits/stl_multimap.h (multimap): Likewise. * include/bits/stl_multiset.h (multiset): Likewise. * include/bits/stl_set.h (set): Likewise. * include/bits/stl_tree.h (_Rb_tree): Likewise. * include/bits/stl_vector.h (vector): Likewise. * include/bits/unordered_map.h (unordered_map, unordered_multimap): Use typename instead of class in template-parameter-list and remove spaces. * include/bits/unordered_set.h (unordered_set, unordered_multiset): Likewise. * testsuite/23_containers/deque/48101-2_neg.cc: New test. * testsuite/23_containers/deque/48101_neg.cc: New test. * testsuite/23_containers/forward_list/48101-2_neg.cc: New test. * testsuite/23_containers/forward_list/48101_neg.cc: New test. * testsuite/23_containers/list/48101-2_neg.cc: New test. * testsuite/23_containers/list/48101_neg.cc: New test. * testsuite/23_containers/map/48101-2_neg.cc: New test. * testsuite/23_containers/map/48101_neg.cc: New test. * testsuite/23_containers/map/operations/31440.cc: Fix comparison object to have const-qualified call operator. * testsuite/23_containers/multimap/48101-2_neg.cc: New test. * testsuite/23_containers/multimap/48101_neg.cc: New test. * testsuite/23_containers/multiset/48101-2_neg.cc: New test. * testsuite/23_containers/multiset/48101_neg.cc: New test. * testsuite/23_containers/set/48101-2_neg.cc: New test. * testsuite/23_containers/set/48101_neg.cc: New test. * testsuite/23_containers/unordered_map/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_map/48101_neg.cc: New test. * testsuite/23_containers/unordered_multimap/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_multimap/48101_neg.cc: New test. * testsuite/23_containers/unordered_multiset/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_multiset/48101_neg.cc: New test. * testsuite/23_containers/unordered_set/48101-2_neg.cc: New test. * testsuite/23_containers/unordered_set/48101_neg.cc: New test. * testsuite/23_containers/unordered_set/instantiation_neg.cc: Adjust dg-error line number. * testsuite/23_containers/vector/48101-2_neg.cc: New test. * testsuite/23_containers/vector/48101_neg.cc: New test. From-SVN: r255035 |